From ca1b60e3bdb19eca981e5ccf4e07100aafddb007 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 11 Mar 2014 20:44:55 -0500 Subject: Move mkpathat to lib, remove redundant function used by patch. --- toys/posix/patch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'toys/posix/patch.c') diff --git a/toys/posix/patch.c b/toys/posix/patch.c index ae24ff94..27828015 100644 --- a/toys/posix/patch.c +++ b/toys/posix/patch.c @@ -385,12 +385,8 @@ void patch_main(void) if ((!strcmp(oldname, "/dev/null") || !oldsum) && access(name, F_OK)) { printf("creating %s\n", name); - s = strrchr(name, '/'); - if (s) { - *s = 0; - xmkpath(name, -1); - *s = '/'; - } + if (mkpathat(AT_FDCWD, name, 0, 2)) + perror_exit("mkpath %s", name); TT.filein = xcreate(name, O_CREAT|O_EXCL|O_RDWR, 0666); } else { printf("patching %s\n", name); -- cgit v1.2.3