elm config save - work around compiler bug that loses local var value

yes. compiler bug. believe it or not.
This commit is contained in:
Carsten Haitzler 2015-07-24 23:57:29 +09:00
parent 8bcd1906b0
commit c0173d8336
1 changed files with 15 additions and 12 deletions

View File

@ -570,6 +570,13 @@ _elm_config_user_dir_snprintf(char *dst,
ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1); ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
#endif #endif
} }
off = user_dir_len + 1;
if (off >= size) return off;
dst[user_dir_len] = '/';
va_start(ap, fmt);
off = off + vsnprintf(dst + off, size - off, fmt, ap);
va_end(ap);
return off;
} }
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) #if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
else else
@ -590,20 +597,16 @@ _elm_config_user_dir_snprintf(char *dst,
ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1); ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
# endif # endif
# endif /* HAVE_GETPWENT */ # endif /* HAVE_GETPWENT */
off = user_dir_len + 1;
if (off >= size) return off;
dst[user_dir_len] = '/';
va_start(ap, fmt);
off = off + vsnprintf(dst + off, size - off, fmt, ap);
va_end(ap);
return off;
} }
#endif #endif
return 0;
off = user_dir_len + 1;
if (off >= size) goto end;
va_start(ap, fmt);
dst[user_dir_len] = '/';
off = off + vsnprintf(dst + off, size - off, fmt, ap);
va_end(ap);
end:
return off;
} }
const char * const char *