Github user danobi commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/274#discussion_r36772358
--- Diff: cmd/traffic_cop/traffic_cop.cc ---
@@ -767,6 +767,26 @@ spawn_manager()
exit(1);
}
+ // Move any traffic.out that we can not write to, out
+ // of the way (TSqa2232)
+ // coverity[fs_check_call]
+ if (access(log_file, W_OK) < 0 && errno == EACCES) {
+ char old_log_file[PATH_NAME_MAX];
+ snprintf(old_log_file, sizeof(old_log_file), "%s.old", log_file);
+ // coverity[toctou]
+ rename(log_file, old_log_file);
--- End diff --
It looks like whether or not rename() fails or overwrites is implementation
specific. However, BaseLogFile::open_file() also checks to see if the file can
be opened, so at the very least the new code's behavior remains consistent with
the current code. Therefore, I think that the potential renaming problem is
outside the scope of this issue/patch.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---