From d28cfa561cfb6144746b04fd53e9294fdd66781e Mon Sep 17 00:00:00 2001 From: Hadrian Węgrzynowski Date: Tue, 12 Mar 2019 21:29:40 +0000 Subject: Use defined constants for mkpathat. --- toys/other/makedevs.c | 2 +- toys/posix/cp.c | 4 ++-- toys/posix/mkdir.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toys/other/makedevs.c b/toys/other/makedevs.c index def1c4b6..fa2b72d8 100644 --- a/toys/other/makedevs.c +++ b/toys/other/makedevs.c @@ -90,7 +90,7 @@ void makedevs_main() } else ptr = node; if (type == 'd') { - if (mkpathat(AT_FDCWD, ptr, mode, 3)) { + if (mkpathat(AT_FDCWD, ptr, mode, MKPATHAT_MKLAST | MKPATHAT_MAKE)) { perror_msg("can't create directory '%s'", ptr); continue; } diff --git a/toys/posix/cp.c b/toys/posix/cp.c index ddbfe125..3b30f8a8 100644 --- a/toys/posix/cp.c +++ b/toys/posix/cp.c @@ -494,7 +494,7 @@ void install_main(void) if (flags & FLAG_d) { for (ss = toys.optargs; *ss; ss++) { - if (mkpathat(AT_FDCWD, *ss, 0777, 3)) perror_msg_raw(*ss); + if (mkpathat(AT_FDCWD, *ss, 0777, MKPATHAT_MKLAST | MKPATHAT_MAKE)) perror_msg_raw(*ss); if (flags & (FLAG_g|FLAG_o)) if (lchown(*ss, TT.uid, TT.gid)) perror_msg("chown '%s'", *ss); if (flags & FLAG_v) printf("%s\n", *ss); @@ -505,7 +505,7 @@ void install_main(void) if (toys.optflags & FLAG_D) { TT.destname = toys.optargs[toys.optc-1]; - if (mkpathat(AT_FDCWD, TT.destname, 0, 2)) + if (mkpathat(AT_FDCWD, TT.destname, 0, MKPATHAT_MAKE)) perror_exit("-D '%s'", TT.destname); if (toys.optc == 1) return; } diff --git a/toys/posix/mkdir.c b/toys/posix/mkdir.c index abb33db4..770300d4 100644 --- a/toys/posix/mkdir.c +++ b/toys/posix/mkdir.c @@ -48,7 +48,7 @@ void mkdir_main(void) // Note, -p and -v flags line up with mkpathat() flags for (s=toys.optargs; *s; s++) { - if (mkpathat(AT_FDCWD, *s, mode, toys.optflags|1)) + if (mkpathat(AT_FDCWD, *s, mode, toys.optflags|MKPATHAT_MKLAST)) perror_msg("'%s'", *s); } } -- cgit v1.2.3