diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/add/pkg_add.1 | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pen.c | 40 |
2 files changed, 15 insertions, 33 deletions
diff --git a/usr.sbin/pkg_install/add/pkg_add.1 b/usr.sbin/pkg_install/add/pkg_add.1 index 50abdf5719f..61790472209 100644 --- a/usr.sbin/pkg_install/add/pkg_add.1 +++ b/usr.sbin/pkg_install/add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_add.1,v 1.3 1998/04/13 14:26:15 millert Exp $ +.\" $OpenBSD: pkg_add.1,v 1.4 1998/04/25 05:09:06 millert Exp $ .\" .\" FreeBSD install - a package for the installation and maintainance .\" of non-core utilities. @@ -116,7 +116,7 @@ options). Use .Ar template as the input to -.Xr mktemp 3 +.Xr mkdtemp 3 when creating a ``staging area.'' By default, this is the string .Pa /var/tmp/instmp.XXXXXX , @@ -125,7 +125,7 @@ space in your .Pa /tmp directory is limited. Be sure to leave some number of `X' characters for -.Xr mktemp 3 +.Xr mkdtemp 3 to fill in with a unique ID. .Pp You can get a performance boost by setting the staging area @@ -345,7 +345,7 @@ flag to .Sh SEE ALSO .Xr ftp 1 , .Xr pkg_info 1 , -.Xr mktemp 3 , +.Xr mkdtemp 3 , .Xr sysconf 3 , .Xr mtree 8 , .Xr pkg_create 1 , diff --git a/usr.sbin/pkg_install/lib/pen.c b/usr.sbin/pkg_install/lib/pen.c index e31c8ff8fce..31b35e22f5f 100644 --- a/usr.sbin/pkg_install/lib/pen.c +++ b/usr.sbin/pkg_install/lib/pen.c @@ -1,7 +1,7 @@ -/* $OpenBSD: pen.c,v 1.5 1997/07/14 14:13:17 graichen Exp $ */ +/* $OpenBSD: pen.c,v 1.6 1998/04/25 05:09:07 millert Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: pen.c,v 1.5 1997/07/14 14:13:17 graichen Exp $"; +static const char *rcsid = "$OpenBSD: pen.c,v 1.6 1998/04/25 05:09:07 millert Exp $"; #endif /* @@ -74,36 +74,18 @@ find_play_pen(char *pen, size_t sz) char * make_playpen(char *pen, size_t sz) { - char *tmp; - int i = 0; - mode_t um; - um = umask(S_IWGRP|S_IWOTH); - while (1) { - if (!find_play_pen(pen, sz)) { - umask(um); - return NULL; - } - - if (!mktemp(pen)) { - barf("Can't mktemp '%s'.", pen); - umask(um); - return NULL; - } - - if (mkdir(pen, 0755) == FAIL) { - if (i++ < 100) { - /* try again! */ - continue; - } - } else - break; - - barf("Can't mkdir '%s'.", pen); - umask(um); + if (!find_play_pen(pen, sz)) { + return NULL; + } + if (!mkdtemp(pen)) { + barf("Can't mkdtemp '%s'.", pen); + return NULL; + } + if (chmod(pen, 0755) == FAIL) { + barf("Can't chmod 0755 '%s'.", pen); return NULL; } - umask(um); if (Verbose) { if (sz) |