]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
.
authorJim Meyering <jim@meyering.net>
Sat, 30 Jul 1994 16:17:45 +0000 (16:17 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 30 Jul 1994 16:17:45 +0000 (16:17 +0000)
src/cp.c

index 3fb200bd16ef1e8d25ebc8fadfa3641c664a2552..fbbc4fd8cc85f33a256a624347a734c2ae0bf2ac 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -37,6 +37,8 @@
 #include "cp.h"
 #include "backupfile.h"
 #include "version.h"
+#include "safe-stat.h"
+#include "safe-lstat.h"
 
 #ifndef _POSIX_VERSION
 uid_t geteuid ();
@@ -295,9 +297,9 @@ main (argc, argv)
      of `stat' to call.  */
 
   if (flag_dereference)
-    xstat = stat;
+    xstat = safe_stat;
   else
-    xstat = lstat;
+    xstat = safe_lstat;
 
   /* Allocate space for remembering copied and created files.  */
 
@@ -328,7 +330,7 @@ do_copy (argc, argv)
 
   dest = argv[argc - 1];
 
-  if (lstat (dest, &sb))
+  if (SAFE_LSTAT (dest, &sb))
     {
       if (errno != ENOENT)
        {
@@ -345,7 +347,7 @@ do_copy (argc, argv)
       /* If `dest' is not a symlink to a nonexistent file, use
         the results of stat instead of lstat, so we can copy files
         into symlinks to directories. */
-      if (stat (dest, &sbx) == 0)
+      if (SAFE_STAT (dest, &sbx) == 0)
        sb = sbx;
     }
 
@@ -437,7 +439,7 @@ do_copy (argc, argv)
         `cp source dest/' to `cp source dest/basename(source)'.  */
 
       if (dest[strlen (dest) - 1] == '/'
-         && lstat (source, &source_stats) == 0
+         && SAFE_LSTAT (source, &source_stats) == 0
          && !S_ISDIR (source_stats.st_mode))
        {
          char *source_base;