diff options
-rw-r--r-- | lib/libskey/skeylogin.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 229fc61..ee9c277 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -103,11 +103,13 @@ char *name; long recstart; char *cp, *p; struct stat statbuf; + mode_t oldmask; /* See if the _PATH_SKEYFILE exists, and create it if not */ if(stat(_PATH_SKEYFILE,&statbuf) == -1 && errno == ENOENT){ + oldmask = umask(S_IRWXG|S_IRWXO); mp->keyfile = fopen(_PATH_SKEYFILE,"w+"); - (void) chmod(_PATH_SKEYFILE, 0644); + (void)umask(oldmask); } else { /* Otherwise open normally for update */ mp->keyfile = fopen(_PATH_SKEYFILE,"r+"); |