Subject: CVS commit: src/bin/mkdir
To: None <>
From: Luke Mewburn <>
List: source-changes
Date: 03/05/2003 05:58:46
Module Name:	src
Committed By:	lukem
Date:		Wed Mar  5 03:58:45 UTC 2003

Modified Files:
	src/bin/mkdir: mkdir.c

Log Message:
Rework -p support again;
- If mkdir() fails on a component (no matter what the error is),
  stat() the result.  If the stat() fails, print the error mkdir() generated.
  Otherwise, if the result is not a directory, explicitly fail with ENOTDIR.
- Move the chmod() of last element to be done only if the mkdir() succeeded
  (i.e, it wasn't an existing directory)

Fixes problem introduced in previous commit where "mkdir -p existing"
on a read-only file system would incorrectly return a non zero exit code,
whilst retaining the race-condition fix of the previous commit.

Thanks to simonb@ for sanity checking my fix versus the standards.

To generate a diff of this commit:
cvs rdiff -r1.27 -r1.28 src/bin/mkdir/mkdir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.