+
+ return 0;
+
+ error_src_dest:
+ close (dest_fd);
+ error_src:
+ close (src_fd);
+ error:
+ return err;
+}
+
+void
+copy_file_preserving (const char *src_filename, const char *dest_filename)
+{
+ switch (qcopy_file_preserving (src_filename, dest_filename))
+ {
+ case 0:
+ return;
+
+ case GL_COPY_ERR_OPEN_READ:
+ error (EXIT_FAILURE, errno, _("error while opening %s for reading"),
+ quote (src_filename));
+
+ case GL_COPY_ERR_OPEN_BACKUP_WRITE:
+ error (EXIT_FAILURE, errno, _("cannot open backup file %s for writing"),
+ quote (dest_filename));
+
+ case GL_COPY_ERR_READ:
+ error (EXIT_FAILURE, errno, _("error reading %s"),
+ quote (src_filename));
+
+ case GL_COPY_ERR_WRITE:
+ error (EXIT_FAILURE, errno, _("error writing %s"),
+ quote (dest_filename));
+
+ case GL_COPY_ERR_AFTER_READ:
+ error (EXIT_FAILURE, errno, _("error after reading %s"),
+ quote (src_filename));
+
+ case GL_COPY_ERR_GET_ACL:
+ error (EXIT_FAILURE, errno, "%s", quote (src_filename));
+
+ case GL_COPY_ERR_SET_ACL:
+ error (EXIT_FAILURE, errno, _("preserving permissions for %s"),
+ quote (dest_filename));
+
+ default:
+ abort ();
+ }