projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
af14c9a
)
.
author
Jim Meyering
<jim@meyering.net>
Sat, 30 Jul 1994 13:12:40 +0000
(13:12 +0000)
committer
Jim Meyering
<jim@meyering.net>
Sat, 30 Jul 1994 13:12:40 +0000
(13:12 +0000)
lib/mkdir.c
patch
|
blob
|
history
diff --git
a/lib/mkdir.c
b/lib/mkdir.c
index e68ccb17c7072923aecf68102e0edc2ca3b6814c..b00199d3fa76c490acea8a590d0d5a3d03d7d46d 100644
(file)
--- a/
lib/mkdir.c
+++ b/
lib/mkdir.c
@@
-1,4
+1,4
@@
-/* mk
rm
dir.c -- BSD compatible directory functions for System V
+/* mkdir.c -- BSD compatible directory functions for System V
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
Copyright (C) 1988, 1990 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@
-15,6
+15,17
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+ using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+ (which it would do because it found this file in $srcdir). */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@
-22,6
+33,18
@@
extern int errno;
#endif
extern int errno;
#endif
+#ifdef STAT_MACROS_BROKEN
+#ifdef S_ISDIR
+#undef S_ISDIR
+#endif
+#endif /* STAT_MACROS_BROKEN. */
+
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+#include "safe-stat.h"
+
/* mkdir and rmdir adapted from GNU tar. */
/* Make directory DPATH, with permission mode DMODE.
/* mkdir and rmdir adapted from GNU tar. */
/* Make directory DPATH, with permission mode DMODE.
@@
-43,7
+66,7
@@
mkdir (dpath, dmode)
int cpid, status;
struct stat statbuf;
int cpid, status;
struct stat statbuf;
- if (
stat
(dpath, &statbuf) == 0)
+ if (
SAFE_STAT
(dpath, &statbuf) == 0)
{
errno = EEXIST; /* stat worked, so it already exists. */
return -1;
{
errno = EEXIST; /* stat worked, so it already exists. */
return -1;
@@
-92,10
+115,10
@@
rmdir (dpath)
int cpid, status;
struct stat statbuf;
int cpid, status;
struct stat statbuf;
- if (
stat
(dpath, &statbuf) != 0)
+ if (
SAFE_STAT
(dpath, &statbuf) != 0)
return -1; /* stat set errno. */
return -1; /* stat set errno. */
- if (
(statbuf.st_mode & S_IFMT) != S_IFDIR
)
+ if (
!S_ISDIR (statbuf.st_mode)
)
{
errno = ENOTDIR;
return -1;
{
errno = ENOTDIR;
return -1;