From aa593d5e2638566ead1e69381e60639550991ff2 Mon Sep 17 00:00:00 2001 From: gdt Date: Mon, 22 Dec 2003 20:15:53 +0000 Subject: 2003-12-22 Christian Hammers * configure.ac (and everywhere a regular file is opened for writing): use file permissions from configure rather than compiled-in umask. --- vtysh/vtysh.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'vtysh') 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; } -- cgit v1.2.1