Hi,

to comment this out does solve the Problem but generates a new one. You
can't save settings any more. So i rewrite the function to this:

Code:
--------------------
    
  /*
  * 
  */
  static int system_atomic_write(lua_State *L)
  {
        const char *fname, *fdata;
        char *tname;
        size_t n, len;
        FILE *fp;
  #if HAVE_FSYNC && !defined(FSYNC_WORKAROUND_ENABLED)
        DIR *dp;
  #endif
        fname = lua_tostring(L, 2);
        fdata = lua_tolstring(L, 3, &len);
  
        tname = alloca(strlen(fname) + 5);
        strcpy(tname, fname);
        strcat(tname, ".new");
        
        if (!(fp = fopen(tname, "w"))) {
                return luaL_error(L, "fopen: %s", strerror(errno));
        }
  
        n = 0;
        while (n < len) {
                n += fwrite(fdata + n, 1, len - n, fp);
  
                if (ferror(fp)) {
                        fclose(fp);
                        return luaL_error(L, "fwrite: %s", strerror(errno));
                }
        }
  
        if (fflush(fp) != 0) {
                fclose(fp);
                return luaL_error(L, "fflush: %s", strerror(errno));
        }
  #if HAVE_FSYNC && !defined(FSYNC_WORKAROUND_ENABLED)
        if (fsync(fileno(fp)) != 0) {
                fclose(fp);
                return luaL_error(L, "fsync: %s", strerror(errno));
        }
  #endif
        if (fclose(fp) != 0) {
                return luaL_error(L, "fclose: %s", strerror(errno));
        }
  
  #if defined(WIN32)
        /* windows systems must delete old file first */
  #ifndef _WIN32_WCE
        if (_access_s(fname, 0) == 0)
  #else 
        if (wceex_access(fname, 0) == 0)
  #endif        
        /*{
                 if (remove(fname) != 0) {
                        return luaL_error(L, "remove old file: %s", 
strerror(errno));
                }
        }*/
  #endif
        remove(fname);
        if (rename(tname, fname) != 0) {
                return luaL_error(L, "rename: %s", strerror(errno));
        }
  
  #ifdef FSYNC_WORKAROUND_ENABLED
        /* sync filesystem if fsync is broken */
        sync();
  #elif HAVE_FSYNC
        if (!(dp = opendir(dirname(tname)))) {
                return luaL_error(L, "opendir: %s", strerror(errno));
        }
        
        if (fsync(dirfd(dp)) != 0) {
                closedir(dp);
                return luaL_error(L, "fsync: %s", strerror(errno));
        }
  
        if (closedir(dp) != 0) {
                return luaL_error(L, "closedir: %s", strerror(errno));
        }
  #endif
  
        return 0;
  }
  
--------------------

i tested it the last hours and it works nice!

I rewrite the WQVGA_SMALL_Skin. It works now in 320x240 Resolution. I
decided to go to landscape view. Later i will post some Screenshots and
the Patch Files. Thanks for help. 

Greets Phil


-- 
Philro
------------------------------------------------------------------------
Philro's Profile: http://forums.slimdevices.com/member.php?userid=29397
View this thread: http://forums.slimdevices.com/showthread.php?t=61925

_______________________________________________
jive mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive

Reply via email to