X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=server-src%2Flogfile.c;h=488bdca5c3e05835f2a384d5f9ead82a45ffdfae;hb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;hp=03cc5f65858078c4d107ccfa10df48de2395eeac;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/server-src/logfile.c b/server-src/logfile.c index 03cc5f6..488bdca 100644 --- a/server-src/logfile.c +++ b/server-src/logfile.c @@ -52,7 +52,7 @@ char *logtype_str[] = { char *program_str[] = { "UNKNOWN", "planner", "driver", "amreport", "dumper", "chunker", - "taper", "amflush" + "taper", "amflush", "amdump", "amidxtaped", "amfetchdump", "amcheckdump" }; int curlinenum; @@ -129,7 +129,8 @@ printf_arglist_function1(void log_add, logtype_t, typ, char *, format) } arglist_start(argp, format); - g_vsnprintf(linebuf, SIZEOF(linebuf)-1, xlated_fmt, argp); + /* use sizeof(linebuf)-2 to save space for a trailing newline */ + g_vsnprintf(linebuf, SIZEOF(linebuf)-2, xlated_fmt, argp); /* -1 to allow for '\n' */ arglist_end(argp); @@ -142,18 +143,19 @@ printf_arglist_function1(void log_add, logtype_t, typ, char *, format) if(multiline == -1) open_log(); - if (fullwrite(logfd, leader, strlen(leader)) < 0) { + if (full_write(logfd, leader, strlen(leader)) < strlen(leader)) { error(_("log file write error: %s"), strerror(errno)); /*NOTREACHED*/ } amfree(leader); + /* add a newline if necessary */ n = strlen(linebuf); if(n == 0 || linebuf[n-1] != '\n') linebuf[n++] = '\n'; linebuf[n] = '\0'; - if (fullwrite(logfd, linebuf, n) < 0) { + if (full_write(logfd, linebuf, n) < n) { error(_("log file write error: %s"), strerror(errno)); /*NOTREACHED*/ }