search for: do_unlink

Displaying 20 results from an estimated 26 matches for "do_unlink".

2004 Feb 17
1
[patch] Make robust_rename() handle EXDEV.
...do_rename(from, to); - if (rc == 0 || errno != ETXTBSY) - return rc; - if (robust_unlink(to) != 0) - return -1; - return do_rename(from, to); + int do_copy = 0, tries = 4, rc; + STRUCT_STAT st; + while (tries--) { + if (do_copy) { + rc = copy_file(from, to, st.st_mode); + if (rc == 0) { + do_unlink(from); + } + } else { + rc = do_rename(from, to); + } + + if (rc == 0) + return 0; + + switch (errno) { +#ifdef ETXTBSY + case ETXTBSY: + if (robust_unlink(to) != 0) + return -1; + break; #endif + case EXDEV: + if (do_stat(from, &st) == -1) { + st.st_mode = 0755; + }...
2003 Sep 05
1
new option suggestion '--backup-only'
...reserve_devices; @@ -133,21 +134,26 @@ int keep_trying = 4; int keep_path_extfs = 0; int failed; + int saveerrno; while (keep_trying) { - if (keep_path_extfs) { + if (keep_path_extfs || backup_only) { failed = copy_file(src, dst, 0755); + saveerrno = errno; if (!failed) { do_unlink(src); + saveerrno = errno; } } else { failed = robust_rename (src, dst); + saveerrno = errno; } if (failed) { if (verbose > 2) rprintf (FERROR, "robust_move failed: %s(%d)\n", strerror (errno), errno); + errno = saveerrno; switch (errno)...
2006 Sep 19
1
--remove-sent-files errors with no output
I've been experimenting with the --remove-sent-files option with patchy success. Often --remove-sent-files will not remove the remote files. It copies them locally but "apparently" failed to remove them remotely. After some experimentation I was able to identify one problem as a permission problem. I continue to have problems with rsync not removing some more files. What troubles
2002 Jan 07
0
rsync-2.5.1 / updated syscall.c "const" patch
...Jan 6 23:12:41 2002 @@ -1,3 +1,4 @@ +/* Converted by prj_src:unix_c_to_vms_c.tpu AND prj_src:syscall.tpu on 6-JAN-2 002 23:12:41.17 OPENVMS_AXP */ /* Copyright (C) Andrew Tridgell 1998 @@ -28,22 +29,24 @@ #define CHECK_RO if (read_only || list_only) {errno = EROFS; return -1;} -int do_unlink(char *fname) +int do_unlink(const char *fname) { if (dry_run) return 0; CHECK_RO return unlink(fname); } -int do_symlink(char *fname1, char *fname2) +#if SUPPORT_LINKS +int do_symlink(const char *fname1, const char *fname2) { if (dry_run) return 0;...
2003 May 21
2
patch to avoid race condition in rsync 2.5.6
...ace */ + set_perms(fnametmp,file,NULL,0); + /* move tmp file over real file */ if (robust_rename(fnametmp,fname) != 0) { if (errno == EXDEV) { @@ -253,7 +256,5 @@ fnametmp,fname,strerror(errno)); } do_unlink(fnametmp); - } else { - set_perms(fname,file,NULL,0); } } The call to set_perms() inside the if-block is to make sure the permissions are still correct even on strange (and to me known) platforms where the permissions are reset when a file is renamed. I'm not sure...
2004 Feb 16
1
[patch] Add `--link-by-hash' option (rev 2).
...linkname) == -1) { + rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n", + full_fname(fname),linkname, + strerror(errno)); + } + } else { + rprintf(FINFO, "link-by-hash (existing): \"%s\" -> %s\n", + linkname, full_fname(fname)); + if (do_unlink(fname) == -1) { + rprintf(FERROR,"unlink \"%s\": %s\n", + full_fname(fname),strerror(errno)); + } else if (do_link(linkname, fname) == -1) { + rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n", + linkname,full_fname(fname), + strerror(er...
2002 May 04
1
A simpler move-files patch
...ir,MAXPATHLEN); + if (strlen(fname) == MAXPATHLEN-1) { + io_error = 1; + rprintf(FERROR, "send_files failed on long-named directory %s\n", + fname); + return; + } + strlcat(fname,"/",MAXPATHLEN); + } + strlcat(fname,f_name(file),MAXPATHLEN); + if (do_unlink(fname) == 0 && verbose > 1) + rprintf(FINFO,"sender removed %s\n",fname); + } } if (verbose > 2) ---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
2004 Jun 21
0
Problem found and fixed with --update
...e_only) { + STRUCT_STAT target_st; + + ret = do_stat(fname, &target_st); + + if(ret == 0) { + if(cmp_modtime(target_st.st_mtime, file->modtime) > 0) { + rprintf(FINFO, "target \"%s\" newer, deleting \"%s\"\n", + fname, fnametmp); + do_unlink(fnametmp); + return; + } + } + } + /* move tmp file over real file */ + ret = robust_rename(fnametmp, fname, file->mode & INITACCESSPERMS); if (ret < 0) { rprintf(FERROR, "%s %s -> \"%s\": %s\n", -- ======================================...
2007 Mar 28
2
copy file upon --delete possible?
...tain info about original path etc.. Not sure whether --backup or some similar option can do this just for deleted files... I was looking through the source to see if this can be hard-coded, and it seems that the function "delete_item" is where it should be done.. specifically in "do_unlink", where one could hard-code a "copy_file" to a fixed trash directory before unlink... Any suggestions?? Cheers Julian
2009 Oct 01
0
patch: --force-change for hard links
...irectory. Error message: rsync: link "/tmp/s/a" => b failed: Operation not permitted (1) The problem is that it's not allowed to link a *chg'ed file. Following patch tries to remove the flag, link the file and then restore the file (actually, the code is similar to code in the do_unlink function). Regards Anatoli Klassen Test case: # mkdir s d # touch s/a # ln s/a s/b # chflags uchg s/a # rsync -v --hard-links --archive --fileflags --force-change s/ d/ sending incremental file list ./ b a => b sent 102 bytes received 43 bytes 290.00 bytes/sec total size is 0 speedup is 0...
2005 May 31
0
[Bug 2758] New: "File exists" error using options -b and --backup-dir with device files.
...IS_DEVICE(file->mode)) { if (am_root && preserve_devices) { + /* delete backup_dir destination device if it exists */ + if (do_stat(buf, &bufst) == 0 && IS_DEVICE(bufst.st_mode)) { + if (do_unlink(buf) < 0) + rsyserr(FERROR, errno, "unlink %s failed", + full_fname(buf)); + } if (do_mknod(buf, file->mode, file->u.rdev) < 0...
2005 Mar 21
4
Patch: Offline transfer mode
...up, in send_files(). A more graceful way, I think, might have been to create a global (say, net_quench) which is set from send_files() and read from write_fd(), to toggle traffic on and off depending on context. I also had to handle deleted files correctly, but that was just a simple addition to do_unlink() and server_options(). This patch is against 2.6.3, but I just now checked CVS HEAD, and I see that, while the patch won't apply directly to HEAD, none of the changes are great enough to make porting it forward a chore. I'll be happy to provide a patch against HEAD if interest is there...
2003 May 20
0
patch for better handling of write failures (disk full)
...} + if (discard) + return 2; return 1; } @@ -458,6 +467,16 @@ close(fd1); } close(fd2); + + /* + * This means a write error occured, and the file is discarded + */ + if (recv_ok == 2) { + if (verbose > 2) + rprintf(FINFO,"discarding %s\n",fname); + do_unlink(fnametmp); + cleanup_disable(); + } else { if (verbose > 2) rprintf(FINFO,"renaming %s to %s\n",fnametmp,fname); @@ -476,6 +495,7 @@ write_int(f_gen,i); } } + } } if (delete_after) { diff -Nru a/rsync/rsync.c b/rsync/rsync.c --- a/rsync/rsync.c Tue...
2008 May 08
1
Patch to not modify files in place unless "--inplace" option specified
...INKS if (preserve_hard_links && F_IS_HLINKED(file)) @@ -1776,13 +1800,31 @@ else if (fnamecmp_type == FNAMECMP_FUZZY) ; else if (unchanged_file(fnamecmp, file, &sx.st)) { + /* fnamecmp == fname, fnamecmp_type == FNAMECMP_FNAME */ + int iflags = 0; + if (partialptr) { do_unlink(partialptr); handle_partial_dir(partialptr, PDIR_DELETE); } - set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT); + if (inplace) { + /* Currently, we call set_file_attrs on all tweakable + * files, though ideally it would have no effect when + * unchanged_attrs returns...
2011 May 31
2
Samba serving sshfs shares: can't delete files
Hello! I have samba share on my sshfs-mounted folder. All works just fine except I can't delete files from sshfs unless they are in 0777 chmodded directory. Even if that files were putted trough smbclient. I can read files, write files (regardless their directory permissions) but not delete them. Here is my share config: [myshare] comment = shre over sshfs path = /home/kli/work/remotes/dev
2003 May 23
1
PATCH: better handling for write failures (disk full)
...} + if (discard) + return 2; return 1; } @@ -458,6 +467,16 @@ close(fd1); } close(fd2); + + /* + * This means a write error occured, and the file is discarded + */ + if (recv_ok == 2) { + if (verbose > 2) + rprintf(FINFO,"discarding %s\n",fname); + do_unlink(fnametmp); + cleanup_disable(); + } else { if (verbose > 2) rprintf(FINFO,"renaming %s to %s\n",fnametmp,fname); @@ -476,6 +495,7 @@ write_int(f_gen,i); } } + } } if (delete_after) { diff -Nru a/rsync/rsync.c b/rsync/rsync.c --- a/rsync/rsync.c Tue...
2023 Jul 03
0
[PATCH] Add option --log-after to log after moving file into place
...+ /* log the transfer result after file is moved into place */ + if (!log_after_transfer) + log_item(log_code, file, iflags, NULL); if (want_progress_now) instant_progress(fname); @@ -917,6 +920,10 @@ int recv_files(int f_in, int f_out, char *local_name) } else if (!one_inplace) do_unlink(fnametmp); + /* log the transfer result */ + if (log_after_transfer) + log_item(FLOG_AFTER, file, iflags, NULL); + cleanup_disable(); if (read_batch) diff --git a/rsync.1.md b/rsync.1.md index 2ae6f481..1991e406 100644 --- a/rsync.1.md +++ b/rsync.1.md @@ -543,6 +543,7 @@ has its own...
2004 May 10
2
read error produces null-byte-filled destination file
I've run into a bug in the IO handling when reading a file. Suppose I have a file that lives on an NFS filesystem. That filesystem is NOT being exported with auth=0 permissions. So, if I try to access a file as root, it successfully opens the file, but subsequent reads fail with EACCES. This produces a destination file full of null bytes. I noticed this with 2.5.7, but checked 2.6.2 as
2008 Mar 04
1
Several changes missing from [HEAD] fileflags.diff
..._make_mutable(const char *fname, uint32 fileflags); > int set_file_attrs(const char *fname, struct file_struct *file, > stat_x *sxp, > const char *fnamecmp, int flags); > RETSIGTYPE sig_int(UNUSED(int val)); > @@ -293,11 +295,12 @@ int sock_exec(const char *prog); > int do_unlink(const char *fname); > int do_symlink(const char *fname1, const char *fname2); > int do_link(const char *fname1, const char *fname2); > -int do_lchown(const char *path, uid_t owner, gid_t group); > +int do_lchown(const char *path, uid_t owner, gid_t group, mode_t > mode, uint32 fi...
2004 Feb 09
1
[patch] Add `--link-by-hash' option.
...p;linkname, "%s/%ld", hashname, + last_fnbr + 1); + } + } + } + + if (first) { + if (do_link(fname, linkname) == -1) { + rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n", + full_fname(fname),linkname, + strerror(errno)); + } + } else { + if (do_unlink(fname) == -1) { + rprintf(FERROR,"unlink \"%s\": %s\n", + full_fname(fname),strerror(errno)); + } else if (do_link(linkname, fname) == -1) { + rprintf(FERROR,"link \"%s\" -> \"%s\": %s\n", + linkname,full_fname(fname), + strerror(er...