=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/util.c,v retrieving revision 1.29 retrieving revision 1.30 diff -c -r1.29 -r1.30 *** src/usr.bin/patch/util.c 2004/11/19 20:00:57 1.29 --- src/usr.bin/patch/util.c 2005/05/16 15:22:46 1.30 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.29 2004/11/19 20:00:57 otto Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.30 2005/05/16 15:22:46 espie Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 27,33 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: util.c,v 1.29 2004/11/19 20:00:57 otto Exp $"; #endif /* not lint */ #include --- 27,33 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: util.c,v 1.30 2005/05/16 15:22:46 espie Exp $"; #endif /* not lint */ #include *************** *** 49,55 **** #include "backupfile.h" #include "pathnames.h" - /* Rename a file, copying it if necessary. */ int --- 49,54 ---- *************** *** 308,313 **** --- 307,313 ---- makedirs(const char *filename, bool striplast) { char *tmpbuf; + mode_t mode, dir_mode; if ((tmpbuf = strdup(filename)) == NULL) fatal("out of memory\n"); *************** *** 318,329 **** return; /* nothing to be done */ *s = '\0'; } ! if (snprintf(buf, sizeof(buf), "%s -p %s", _PATH_MKDIR, tmpbuf) ! >= sizeof(buf)) ! fatal("buffer too small to hold %.20s...\n", tmpbuf); ! ! if (system(buf)) ! pfatal("%.40s failed", buf); } /* --- 318,328 ---- 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) ! pfatal("creation of %s failed", tmpbuf); ! free(tmpbuf); } /*