summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-06-20 07:14:07 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-06-20 07:14:07 +0000
commit98879a571dcaaeee3548acace8c6453f7765802e (patch)
treeb8687d42f6c42dcc8c967d0cc6fa0d2af2ae1edf
parent3957ca90a5622f6255ef6db322a41f7ffdfe46f4 (diff)
umask juggling not needed; with Lionel Fourquaux.
ok millert@ espie@
-rw-r--r--usr.bin/patch/mkpath.c9
-rw-r--r--usr.bin/patch/util.c9
-rw-r--r--usr.bin/patch/util.h4
3 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/patch/mkpath.c b/usr.bin/patch/mkpath.c
index a983768adc3..1e600a8a8ba 100644
--- a/usr.bin/patch/mkpath.c
+++ b/usr.bin/patch/mkpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkpath.c,v 1.1 2005/05/16 15:22:46 espie Exp $ */
+/* $OpenBSD: mkpath.c,v 1.2 2005/06/20 07:14:06 otto Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -38,11 +38,9 @@
* mkpath -- create directories.
* path - path
- * mode - file mode of terminal directory
- * dir_mode - file mode of intermediate directories
*/
int
-mkpath(char *path, mode_t mode, mode_t dir_mode)
+mkpath(char *path)
{
struct stat sb;
char *slash;
@@ -58,8 +56,7 @@ mkpath(char *path, mode_t mode, mode_t dir_mode)
*slash = '\0';
if (stat(path, &sb)) {
- if (errno != ENOENT ||
- (mkdir(path, done ? mode : dir_mode) &&
+ if (errno != ENOENT || (mkdir(path, 0777) &&
errno != EEXIST)) {
warn("%s", path);
return (-1);
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index cb3b2f02f07..52e00c6ddf9 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.30 2005/05/16 15:22:46 espie Exp $ */
+/* $OpenBSD: util.c,v 1.31 2005/06/20 07:14:06 otto Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: util.c,v 1.30 2005/05/16 15:22:46 espie Exp $";
+static const char rcsid[] = "$OpenBSD: util.c,v 1.31 2005/06/20 07:14:06 otto Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -307,7 +307,6 @@ void
makedirs(const char *filename, bool striplast)
{
char *tmpbuf;
- mode_t mode, dir_mode;
if ((tmpbuf = strdup(filename)) == NULL)
fatal("out of memory\n");
@@ -318,9 +317,7 @@ makedirs(const char *filename, bool striplast)
return; /* nothing to be done */
*s = '\0';
}
- mode = 0777 & ~umask(0);
- dir_mode = mode | S_IWUSR | S_IXUSR;
- if (mkpath(tmpbuf, mode, dir_mode) != 0)
+ if (mkpath(tmpbuf) != 0)
pfatal("creation of %s failed", tmpbuf);
free(tmpbuf);
}
diff --git a/usr.bin/patch/util.h b/usr.bin/patch/util.h
index b86358e0e55..b27bbe3cc3a 100644
--- a/usr.bin/patch/util.h
+++ b/usr.bin/patch/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.14 2005/05/16 15:22:46 espie Exp $ */
+/* $OpenBSD: util.h,v 1.15 2005/06/20 07:14:06 otto Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -47,4 +47,4 @@ void version(void);
void my_exit(int) __attribute__((noreturn));
/* in mkpath.c */
-extern int mkpath(char *, mode_t, mode_t);
+extern int mkpath(char *);