#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <assert.h>
#include "e2fsck.h"
#include <pwd.h>
{
s->s = malloc(len);
/* e2fsck_allocate_memory(ctx, len, "logfile name"); */
- s->len = len;
+ s->len = s->s ? len : 0;
s->end = 0;
}
case 'Y':
sprintf(buf, "%d", tm->tm_year + 1900);
break;
+ default:
+ sprintf(buf, "%%%c", ch);
+ break;
}
append_string(s, buf, 0);
}
struct string s, s1, s2;
char *s0 = 0, *log_dir = 0, *log_fn = 0;
int log_dir_wait = 0;
+ char string_index[10];
s.s = s1.s = s2.s = 0;
goto out;
expand_logfn(ctx, log_fn, &s);
+#ifdef HAVE_PTHREAD
+ if (ctx->global_ctx) {
+ sprintf(string_index, "%d",
+ ctx->thread_info.et_thread_index);
+ append_string(&s, ".", 1);
+ append_string(&s, string_index, 0);
+ }
+#endif
+
if ((log_fn[0] == '/') || !log_dir || !log_dir[0])
s0 = s.s;
append_string(&s2, log_dir, 0);
append_string(&s2, "/", 1);
append_string(&s2, s.s, 0);
- printf("%s\n", s2.s);
}
if (s0)