Keep the permissions of the original file when creating a backup.
This commit is contained in:
parent
2b820c534d
commit
4471e5419d
@ -301,15 +301,12 @@ static int create_backup (const char *backup, FILE * fp)
|
|||||||
struct utimbuf ub;
|
struct utimbuf ub;
|
||||||
FILE *bkfp;
|
FILE *bkfp;
|
||||||
int c;
|
int c;
|
||||||
mode_t mask;
|
|
||||||
|
|
||||||
if (fstat (fileno (fp), &sb) != 0) {
|
if (fstat (fileno (fp), &sb) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask = umask (077);
|
bkfp = fopen_set_perms (backup, "w", &sb);
|
||||||
bkfp = fopen (backup, "w");
|
|
||||||
(void) umask (mask);
|
|
||||||
if (NULL == bkfp) {
|
if (NULL == bkfp) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user