diff options
author | Donald Sharp <sharpd@nvidia.com> | 2021-01-18 15:32:00 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-01-18 15:32:00 +0100 |
commit | 46e6f9f2ad21296c643686622419ce4122730aa7 (patch) | |
tree | d57e7146f3bc237537a8e90353d729782d93381b /lib | |
parent | bgpd: Use uint32_t for size value instead of int in ecommunity struct (diff) | |
download | frr-46e6f9f2ad21296c643686622419ce4122730aa7.tar.xz frr-46e6f9f2ad21296c643686622419ce4122730aa7.zip |
lib: Correctly set temp file permissions
Set the temp file permissions to limit who can read
the file.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/northbound_cli.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 7048df99f..853f64347 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -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(); |