diff options
author | gdt <gdt> | 2003-12-22 20:15:53 +0000 |
---|---|---|
committer | gdt <gdt> | 2003-12-22 20:15:53 +0000 |
commit | aa593d5e2638566ead1e69381e60639550991ff2 (patch) | |
tree | c865f642c1029fa47b8fc6cc86302468b9b2aef4 /vtysh | |
parent | 47ce02a8f12134a6ba515fbf1d2b9276e39d4c06 (diff) |
2003-12-22 Christian Hammers <ch@lathspell.de>
* configure.ac (and everywhere a regular file is opened for
writing): use file permissions from configure rather than
compiled-in umask.
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 74707f9c..e9c784a5 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1287,14 +1287,10 @@ DEFUN (no_vtysh_write_config, int write_config_integrated(void) { int ret; - mode_t old_umask; char line[] = "write terminal\n"; FILE *fp; char *integrate_sav = NULL; - /* config files have 0600 perms... */ - old_umask = umask (0077); - integrate_sav = malloc (strlen (integrate_default) + strlen (CONF_BACKUP_EXT) + 1); strcpy (integrate_sav, integrate_default); @@ -1312,7 +1308,6 @@ int write_config_integrated(void) if (fp == NULL) { fprintf (stdout,"%% Can't open configuration file %s.\n", integrate_default); - umask (old_umask); return CMD_SUCCESS; } @@ -1329,11 +1324,17 @@ int write_config_integrated(void) fclose (fp); + if (chmod (integrate_default, CONFIGFILE_MASK) != 0) + { + fprintf (stdout,"%% Can't chmod configuration file %s: %s (%d)\n", + integrate_default, strerror(errno), errno); + return CMD_WARNING; + } + fprintf(stdout,"Integrated configuration saved to %s\n",integrate_default); fprintf (stdout,"[OK]\n"); - umask (old_umask); return CMD_SUCCESS; } |