Commit
b71a041364d28d6a56905a770cd20d1497ee26ec added the O_APPEND flag when
opening the log file to allow sites to use logrotate's "copy and truncate"
feature.
Add the O_APPEND to MR-AFS style logs as well so MR-AFS style logs can also be
handled correctly with logrotate, we have consistent open flags, and can remove
a duplicate call to open the log file descriptor.
Change-Id: I8370838e1e2c7ddaa042508d6b9cbe1299339f68
Reviewed-on: https://gerrit.openafs.org/12218
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
}
if (!isfifo)
rk_rename(fileName, FileName); /* don't check error code */
- tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | (isfifo?O_NONBLOCK:0), 0666);
} else {
strcpy(oldName, fileName);
strcat(oldName, ".old");
/* don't check error */
if (!isfifo)
rk_rename(fileName, oldName);
- tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | O_APPEND | (isfifo?O_NONBLOCK:0), 0666);
}
+ tempfd = open(fileName, O_WRONLY | O_TRUNC | O_CREAT | O_APPEND | (isfifo?O_NONBLOCK:0), 0666);
if (tempfd < 0) {
printf("Unable to open log file %s\n", fileName);
return -1;