]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/copy.c
tree-wide: use UINT64_MAX or friends
[thirdparty/systemd.git] / src / basic / copy.c
index 6bb02c03a6638fad8fd13abbca593e35b8a3429e..6391e34ed63c82e7067d722e1c0ebabca06e2a17 100644 (file)
@@ -361,7 +361,7 @@ int copy_bytes_full(
                                 return r;
                 }
 
-                if (max_bytes != (uint64_t) -1) {
+                if (max_bytes != UINT64_MAX) {
                         assert(max_bytes >= (uint64_t) n);
                         max_bytes -= n;
                 }
@@ -642,7 +642,7 @@ static int fd_copy_regular(
         if (fdt < 0)
                 return -errno;
 
-        r = copy_bytes_full(fdf, fdt, (uint64_t) -1, copy_flags, NULL, NULL, progress, userdata);
+        r = copy_bytes_full(fdf, fdt, UINT64_MAX, copy_flags, NULL, NULL, progress, userdata);
         if (r < 0) {
                 (void) unlinkat(dt, to, 0);
                 return r;
@@ -1051,7 +1051,7 @@ int copy_file_fd_full(
         if (fdf < 0)
                 return -errno;
 
-        r = copy_bytes_full(fdf, fdt, (uint64_t) -1, copy_flags, NULL, NULL, progress_bytes, userdata);
+        r = copy_bytes_full(fdf, fdt, UINT64_MAX, copy_flags, NULL, NULL, progress_bytes, userdata);
 
         (void) copy_times(fdf, fdt, copy_flags);
         (void) copy_xattr(fdf, fdt);
@@ -1081,7 +1081,7 @@ int copy_file_full(
         if (fdf < 0)
                 return -errno;
 
-        if (mode == (mode_t) -1)
+        if (mode == MODE_INVALID)
                 if (fstat(fdf, &st) < 0)
                         return -errno;
 
@@ -1092,7 +1092,7 @@ int copy_file_full(
                                 return r;
                 }
                 fdt = open(to, flags|O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY,
-                           mode != (mode_t) -1 ? mode : st.st_mode);
+                           mode != MODE_INVALID ? mode : st.st_mode);
                 if (copy_flags & COPY_MAC_CREATE)
                         mac_selinux_create_file_clear();
                 if (fdt < 0)
@@ -1102,7 +1102,7 @@ int copy_file_full(
         if (chattr_mask != 0)
                 (void) chattr_fd(fdt, chattr_flags, chattr_mask & CHATTR_EARLY_FL, NULL);
 
-        r = copy_bytes_full(fdf, fdt, (uint64_t) -1, copy_flags, NULL, NULL, progress_bytes, userdata);
+        r = copy_bytes_full(fdf, fdt, UINT64_MAX, copy_flags, NULL, NULL, progress_bytes, userdata);
         if (r < 0) {
                 close(fdt);
                 (void) unlink(to);