chiark / gitweb /
util: loop_write - accept 0-length message
[elogind.git] / src / shared / copy.c
index 9e4c3b0f72834ff44e3c6a418bfbf0e0a801944c..1282cb88be7f076b3e390a3131a301da6c7304c0 100644 (file)
@@ -360,7 +360,7 @@ int copy_file_fd(const char *from, int fdt, bool try_reflink) {
 }
 
 int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned chattr_flags) {
-        int fdt, r;
+        int fdt = -1, r;
 
         assert(from);
         assert(to);
@@ -372,7 +372,7 @@ int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned
         }
 
         if (chattr_flags != 0)
-                (void) chattr_fd(fdt, true, chattr_flags);
+                (void) chattr_fd(fdt, chattr_flags, (unsigned) -1);
 
         r = copy_file_fd(from, fdt, true);
         if (r < 0) {
@@ -390,7 +390,7 @@ int copy_file(const char *from, const char *to, int flags, mode_t mode, unsigned
 }
 
 int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace, unsigned chattr_flags) {
-        _cleanup_free_ char *t;
+        _cleanup_free_ char *t = NULL;
         int r;
 
         assert(from);
@@ -421,7 +421,7 @@ int copy_file_atomic(const char *from, const char *to, mode_t mode, bool replace
 int copy_times(int fdf, int fdt) {
         struct timespec ut[2];
         struct stat st;
-        usec_t crtime;
+        usec_t crtime = 0;
 
         assert(fdf >= 0);
         assert(fdt >= 0);