diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1998-10-20 12:36:36 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1998-10-20 12:36:36 +0000 |
| commit | eb356f9af0e59093df6c605922180f17cf27da3e (patch) | |
| tree | 40ef7ae4a638498d0801296812153f53f3f17218 /lib/libc | |
| parent | 4da8edd59ed91c145d89d24c82d14cd66c32fd97 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/stdio/mktemp.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index ca3fa5bdac3d..fd43c4547f40 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: mktemp.c,v 1.9 1998/03/03 14:38:36 bde Exp $"; + "$Id: mktemp.c,v 1.10 1998/04/14 07:25:05 peter Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -56,23 +56,39 @@ int mkstemp(path) char *path; { - int fd; + int fd, rval; + mode_t oldumask; - return (_gettemp(path, &fd, 0) ? fd : -1); + oldumask = umask(077); + rval = (_gettemp(path, &fd, 0) ? fd : -1); + umask(oldumask); + return rval; } char * mkdtemp(path) char *path; { - return(_gettemp(path, (int *)NULL, 1) ? path : (char *)NULL); + char *rval; + mode_t oldumask; + + oldumask = umask(077); + rval = (_gettemp(path, (int *)NULL, 1) ? path : (char *)NULL); + umask(oldumask); + return rval; } char * _mktemp(path) char *path; { - return(_gettemp(path, (int *)NULL, 0) ? path : (char *)NULL); + char *rval; + mode_t oldumask; + + oldumask = umask(077); + rval = (_gettemp(path, (int *)NULL, 0) ? path : (char *)NULL); + umask(oldumask); + return rval; } #ifdef UNSAFE_WARN |
