Deleted Added
full compact
mkdir.c (91084) mkdir.c (91235)
1/*
2 * Copyright (c) 1983, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94";
43#endif
44static const char rcsid[] =
1/*
2 * Copyright (c) 1983, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/bin/mkdir/mkdir.c 91084 2002-02-22 21:11:03Z markm $";
45 "$FreeBSD: head/bin/mkdir/mkdir.c 91235 2002-02-25 09:17:44Z sobomax $";
46#endif /* not lint */
47
48#include <sys/types.h>
49#include <sys/stat.h>
50
51#include <err.h>
52#include <errno.h>
53#include <libgen.h>

--- 115 unchanged lines hidden (view full) ---

169 oumask = umask(0);
170 numask = oumask & ~(S_IWUSR | S_IXUSR);
171 (void)umask(numask);
172 first = 0;
173 }
174 if (last)
175 (void)umask(oumask);
176 if (mkdir(path, last ? omode : S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
46#endif /* not lint */
47
48#include <sys/types.h>
49#include <sys/stat.h>
50
51#include <err.h>
52#include <errno.h>
53#include <libgen.h>

--- 115 unchanged lines hidden (view full) ---

169 oumask = umask(0);
170 numask = oumask & ~(S_IWUSR | S_IXUSR);
171 (void)umask(numask);
172 first = 0;
173 }
174 if (last)
175 (void)umask(oumask);
176 if (mkdir(path, last ? omode : S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
177 if (errno == EEXIST) {
177 if (errno == EEXIST || errno == EISDIR) {
178 if (stat(path, &sb) < 0) {
179 warn("%s", path);
180 retval = 1;
181 break;
182 } else if (!S_ISDIR(sb.st_mode)) {
183 if (last)
184 errno = EEXIST;
185 else

--- 27 unchanged lines hidden ---
178 if (stat(path, &sb) < 0) {
179 warn("%s", path);
180 retval = 1;
181 break;
182 } else if (!S_ISDIR(sb.st_mode)) {
183 if (last)
184 errno = EEXIST;
185 else

--- 27 unchanged lines hidden ---