summaryrefslogtreecommitdiff
path: root/lib/makepath.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-07-30 13:13:52 +0000
committerJim Meyering <jim@meyering.net>1994-07-30 13:13:52 +0000
commitbe7d4a230e880a12b89a4c27263048fc8b8c063a (patch)
tree92ecefb02cc0860ee746931d0d5c329e3031a424 /lib/makepath.c
parenta1d3a7aee63a2a6cbeedeea9ff578844a160f122 (diff)
downloadcoreutils-be7d4a230e880a12b89a4c27263048fc8b8c063a.tar.xz
Use SAFE_STAT instead of stat to avoid unnecessary failure
on systems for which stat can return EINTR.
Diffstat (limited to 'lib/makepath.c')
-rw-r--r--lib/makepath.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/makepath.c b/lib/makepath.c
index 4d647b5ef..e109865c5 100644
--- a/lib/makepath.c
+++ b/lib/makepath.c
@@ -86,6 +86,7 @@ typedef int uid_t;
typedef int gid_t;
#endif
+#include "safe-stat.h"
void error ();
/* Ensure that the directory ARGPATH exists.
@@ -121,7 +122,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
dirpath = (char *) alloca (strlen (argpath) + 1);
strcpy (dirpath, argpath);
- if (stat (dirpath, &stats))
+ if (SAFE_STAT (dirpath, &stats))
{
char *slash;
int tmp_mode; /* Initial perms for leading dirs. */
@@ -155,7 +156,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
while ((slash = index (slash, '/')))
{
*slash = '\0';
- if (stat (dirpath, &stats))
+ if (SAFE_STAT (dirpath, &stats))
{
if (mkdir (dirpath, tmp_mode))
{
@@ -209,7 +210,7 @@ make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
/* The path could end in "/." or contain "/..", so test
if we really have to create the directory. */
- if (stat (dirpath, &stats) && mkdir (dirpath, mode))
+ if (SAFE_STAT (dirpath, &stats) && mkdir (dirpath, mode))
{
error (0, errno, "cannot make directory `%s'", dirpath);
umask (oldmask);