summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-04-26 12:54:51 +0000
committerJim Meyering <jim@meyering.net>1999-04-26 12:54:51 +0000
commitd1c7f62ba8b3a5de6fd66873e49359aa9c4c863e (patch)
tree4310b34d5e82eea316cc39ae3bfc79592800533f /src
parent5d76644c3ead13e24bf9842e418ec130d7157a32 (diff)
downloadcoreutils-d1c7f62ba8b3a5de6fd66873e49359aa9c4c863e.tar.xz
(copy_reg, copy_internal): Use proper mode_t types and macros.
Don't assume the traditional Unix values for mode bits.
Diffstat (limited to 'src')
-rw-r--r--src/copy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/copy.c b/src/copy.c
index 675d813f9..c8a3d92ca 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -195,7 +195,7 @@ copy_reg (const char *src_path, const char *dst_path,
/* Create the new regular file with small permissions initially,
to not create a security hole. */
- dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (dest_desc < 0)
{
error (0, errno, _("cannot create regular file `%s'"), dst_path);
@@ -488,9 +488,9 @@ copy_internal (const char *src_path, const char *dst_path,
if (euidaccess (dst_path, W_OK) != 0)
{
fprintf (stderr,
- _("%s: overwrite `%s', overriding mode %04o? "),
+ _("%s: overwrite `%s', overriding mode %04lo? "),
program_name, dst_path,
- (unsigned int) (dst_sb.st_mode & 07777));
+ (unsigned long) (dst_sb.st_mode & CHMOD_MODE_BITS));
}
else
{
@@ -558,7 +558,7 @@ copy_internal (const char *src_path, const char *dst_path,
/* Temporarily change mode to allow overwriting. */
if (euidaccess (dst_path, W_OK | X_OK) != 0)
{
- if (chmod (dst_path, 0700))
+ if (chmod (dst_path, S_IRWXU))
{
error (0, errno, "%s", dst_path);
return 1;
@@ -682,7 +682,7 @@ copy_internal (const char *src_path, const char *dst_path,
/* Create the new directory writable and searchable, so
we can create new entries in it. */
- if (mkdir (dst_path, (src_mode & x->umask_kill) | 0700))
+ if (mkdir (dst_path, (src_mode & x->umask_kill) | S_IRWXU))
{
error (0, errno, _("cannot create directory `%s'"), dst_path);
goto un_backup;