File lftp-check-newput.patch of Package lftp

--- src/FileCopy.cc
+++ src/FileCopy.cc
@@ -1689,8 +1689,14 @@
 
 FileCopyPeerFDStream *FileCopyPeerFDStream::NewPut(const char *file,bool cont)
 {
-   return new FileCopyPeerFDStream(new FileStream(file,O_WRONLY|O_CREAT
-				    |(cont?0:O_TRUNC)),FileCopyPeer::PUT);
+   int flags=O_WRONLY|O_CREAT;
+   if(!cont) {
+      flags|=O_TRUNC;
+      if(!ResMgr::QueryBool("xfer:clobber",0))
+        flags|=O_EXCL;
+   }
+   return new FileCopyPeerFDStream(new FileStream(file,flags),
+                                   FileCopyPeer::PUT);
 }
 FileCopyPeerFDStream *FileCopyPeerFDStream::NewGet(const char *file)
 {
openSUSE Build Service is sponsored by