summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-04-26 12:43:12 +0000
committerJim Meyering <jim@meyering.net>2000-04-26 12:43:12 +0000
commit5aeb94aeb465247eba01dd019481f53368c6ce39 (patch)
tree15b1f3bbc9e8da8ee0f62287b4cb6ba913ea812e /src
parent2f4177fa6bc430dbd9bf13752abe863e452a1384 (diff)
downloadcoreutils-5aeb94aeb465247eba01dd019481f53368c6ce39.tar.xz
Rename global: s/path_mode/create_parents/.
(main): No longer perform explicit chmod when creating parent directories, since make_path now does the chmod.
Diffstat (limited to 'src')
-rw-r--r--src/mkdir.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/src/mkdir.c b/src/mkdir.c
index 00b8b5cd3..233827d8c 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -1,5 +1,5 @@
/* mkdir -- make directories
- Copyright (C) 90, 1995-1999 Free Software Foundation, Inc.
+ Copyright (C) 90, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
char *program_name;
/* If nonzero, ensure that all parents of the specified directory exist. */
-static int path_mode;
+static int create_parents;
static struct option const longopts[] =
{
@@ -91,7 +91,7 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- path_mode = 0;
+ create_parents = 0;
while ((optc = getopt_long (argc, argv, "pm:", longopts, NULL)) != -1)
{
@@ -100,7 +100,7 @@ main (int argc, char **argv)
case 0: /* Long option. */
break;
case 'p':
- path_mode = 1;
+ create_parents = 1;
break;
case 'm':
symbolic_mode = optarg;
@@ -136,7 +136,7 @@ main (int argc, char **argv)
for (; optind < argc; ++optind)
{
int fail = 0;
- if (path_mode)
+ if (create_parents)
{
fail = make_path (argv[optind], newmode, parent_mode,
-1, -1, 1, verbose_fmt_string);
@@ -148,18 +148,17 @@ main (int argc, char **argv)
error (0, errno, _("cannot create directory `%s'"), argv[optind]);
else if (verbose_fmt_string)
error (0, 0, verbose_fmt_string, argv[optind]);
- }
- /* FIXME: move this functionality into make_path. */
- /* mkdir(2) is required to honor only the file permission bits.
- In particular, it needn't do anything about `special' bits,
- so if any were set in newmode, apply them with chmod. */
- if (fail == 0 && (newmode & ~S_IRWXUGO))
- {
- fail = chmod (argv[optind], newmode);
- if (fail)
- error (0, errno, _("cannot set permissions of directory `%s'"),
- argv[optind]);
+ /* mkdir(2) is required to honor only the file permission bits.
+ In particular, it needn't do anything about `special' bits,
+ so if any were set in newmode, apply them with chmod. */
+ if (fail == 0 && (newmode & ~S_IRWXUGO))
+ {
+ fail = chmod (argv[optind], newmode);
+ if (fail)
+ error (0, errno, _("cannot set permissions of directory `%s'"),
+ argv[optind]);
+ }
}
errors |= fail;