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);
#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)
else
@ -590,20 +597,16 @@ _elm_config_user_dir_snprintf(char *dst,
ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
# endif
# 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
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;
return 0;
}
const char *