aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/patch.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-03-11 20:44:55 -0500
committerRob Landley <rob@landley.net>2014-03-11 20:44:55 -0500
commitca1b60e3bdb19eca981e5ccf4e07100aafddb007 (patch)
tree96c6370fc73f015c20031194551d9238dd176191 /toys/posix/patch.c
parenta8b88fe47237028fb5314c4c572a738b967b10b7 (diff)
downloadtoybox-ca1b60e3bdb19eca981e5ccf4e07100aafddb007.tar.gz
Move mkpathat to lib, remove redundant function used by patch.
Diffstat (limited to 'toys/posix/patch.c')
-rw-r--r--toys/posix/patch.c8
1 files changed, 2 insertions, 6 deletions
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);