]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Correctly set temp file permissions 7884/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 18 Jan 2021 14:32:00 +0000 (09:32 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 18 Jan 2021 14:32:00 +0000 (09:32 -0500)
Set the temp file permissions to limit who can read
the file.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
lib/northbound_cli.c

index 7048df99fba4b09470620fb454f32ce225169c36..853f6434721255f5c976e2a0759d68163b01f767 100644 (file)
@@ -693,6 +693,12 @@ static int nb_write_config(struct nb_config *config, enum nb_cfg_format format,
                          __func__, safe_strerror(errno));
                return -1;
        }
+       if (fchmod(fd, CONFIGFILE_MASK) != 0) {
+               flog_warn(EC_LIB_SYSTEM_CALL,
+                         "%s: fchmod() failed: %s(%d):", __func__,
+                         safe_strerror(errno), errno);
+               return -1;
+       }
 
        /* Make vty for configuration file. */
        file_vty = vty_new();