diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-07-22 19:30:10 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-07-22 19:42:18 +0200 |
commit | 3ec02c097536cfc5422f4580734fde26eef14841 (patch) | |
tree | acf4f3069888ce43a04ae941c2135f04f46793b1 | |
parent | e07670c15b0e15d9fa8d1c23adf60a6ef66ea765 (diff) | |
download | passt-3ec02c097536cfc5422f4580734fde26eef14841.tar passt-3ec02c097536cfc5422f4580734fde26eef14841.tar.gz passt-3ec02c097536cfc5422f4580734fde26eef14841.tar.bz2 passt-3ec02c097536cfc5422f4580734fde26eef14841.tar.lz passt-3ec02c097536cfc5422f4580734fde26eef14841.tar.xz passt-3ec02c097536cfc5422f4580734fde26eef14841.tar.zst passt-3ec02c097536cfc5422f4580734fde26eef14841.zip |
passt: Truncate PID file on open()
Otherwise, if the current PID has fewer digits than a previously
written one, the content will be wrong.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | passt.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -390,7 +390,7 @@ int main(int argc, char **argv) if (*c.pid_file) { if ((pidfile_fd = open(c.pid_file, - O_CREAT | O_WRONLY | O_CLOEXEC, + O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) { perror("PID file open"); exit(EXIT_FAILURE); |