diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2008-05-28 10:48:11 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2008-05-28 10:48:11 -0700 |
commit | b13a89e445f92f96e90a1683539e28663487af16 (patch) | |
tree | 9bc900d9606d157d4361e7a4c1d59c1a12efa45a | |
parent | edf9cd73cc9dcdd2a3e09a61ffbe0cc0b578f588 (diff) |
173.14.05173.14.05
-rw-r--r-- | DRIVER_VERSION | 2 | ||||
-rw-r--r-- | backup.c | 22 | ||||
-rw-r--r-- | nvidia-installer.c | 3 |
3 files changed, 18 insertions, 9 deletions
diff --git a/DRIVER_VERSION b/DRIVER_VERSION index 4d72c1b..e188a0b 100644 --- a/DRIVER_VERSION +++ b/DRIVER_VERSION @@ -1 +1 @@ -173.08 +173.14.05 @@ -143,6 +143,7 @@ static char *create_backwards_compatible_version_string(const char *str); int init_backup(Options *op, Package *p) { + mode_t orig_mode; char *version; FILE *log; @@ -160,9 +161,22 @@ int init_backup(Options *op, Package *p) return FALSE; } + /* + * fopen below creates the file with mode 0666 & ~umask. + * In order to ensure the result of that calculation is BACKUP_LOG_PERMS, + * we temporarily set umask to ~BACKUP_LOG_PERMS to leave just the bits + * we want. + * + * This assumes that BACKUP_LOG does not already exist (if it does, the + * file permissions will not be modified.) This is assured by the + * directory removal and re-creation code above. + */ + orig_mode = umask(~BACKUP_LOG_PERMS); + /* create the log file */ log = fopen(BACKUP_LOG, "a"); + umask(orig_mode); if (!log) { ui_error(op, "Unable to create backup log file '%s' (%s).", BACKUP_LOG, strerror(errno)); @@ -186,14 +200,6 @@ int init_backup(Options *op, Package *p) return FALSE; } - /* set the log file permissions */ - - if (chmod(BACKUP_LOG, BACKUP_LOG_PERMS) == -1) { - ui_error(op, "Unable to set file permissions %04o for %s (%s).", - BACKUP_LOG_PERMS, BACKUP_LOG, strerror(errno)); - return FALSE; - } - return TRUE; } /* init_backup() */ diff --git a/nvidia-installer.c b/nvidia-installer.c index c2c9652..394be97 100644 --- a/nvidia-installer.c +++ b/nvidia-installer.c @@ -495,6 +495,9 @@ int main(int argc, char *argv[]) { Options *op; int ret = FALSE; + + /* Ensure created files get the permissions we expect */ + umask(022); /* parse the commandline options */ |