projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 2.6.1
[debian/amanda]
/
server-src
/
logfile.c
diff --git
a/server-src/logfile.c
b/server-src/logfile.c
index 03cc5f65858078c4d107ccfa10df48de2395eeac..488bdca5c3e05835f2a384d5f9ead82a45ffdfae 100644
(file)
--- 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",
char *program_str[] = {
"UNKNOWN", "planner", "driver", "amreport", "dumper", "chunker",
- "taper", "amflush"
+ "taper", "amflush"
, "amdump", "amidxtaped", "amfetchdump", "amcheckdump"
};
int curlinenum;
};
int curlinenum;
@@
-129,7
+129,8
@@
printf_arglist_function1(void log_add, logtype_t, typ, char *, format)
}
arglist_start(argp, 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);
/* -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(multiline == -1) open_log();
- if (full
write(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);
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';
n = strlen(linebuf);
if(n == 0 || linebuf[n-1] != '\n') linebuf[n++] = '\n';
linebuf[n] = '\0';
- if (full
write(logfd, linebuf, n) < 0
) {
+ if (full
_write(logfd, linebuf, n) < n
) {
error(_("log file write error: %s"), strerror(errno));
/*NOTREACHED*/
}
error(_("log file write error: %s"), strerror(errno));
/*NOTREACHED*/
}