On Thu, Sep 11, 2014 at 07:19:53PM -0400, Stephen Powell wrote: > being made in /etc/lftp.conf.) The significant point is that debug > output is being directed to a file by means of the "-o" option of > the debug command, instead of being written to the terminal. Now > here is the circumvention technique that I use to get around the > problem. If I manually erase (rm) the debug output file, > getmyfile.output, left over from the previous run of the command, > before invoking the command again, I get the expected output in > getmyfile.output. But if I don't erase the getmyfile.output file > before running the command, and this second run of the command > produces less debug output than the first run did, then there will > be left-over output from the previous run of the command at the end > of the file.
Ok, I see now. This patch should fix the problem and the debug output will be appended to the file as intended. The problem was that the fcntl call cleared O_APPEND flag. -- Alexander.
diff --git a/src/commands.cc b/src/commands.cc index c17fcc4..b14b71b 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2046,13 +2046,12 @@ CMD(debug) debug_file_name=optarg; if(fd!=-1) close(fd); - fd=open(debug_file_name,O_WRONLY|O_CREAT|O_APPEND,0600); + fd=open(debug_file_name,O_WRONLY|O_CREAT|O_APPEND|O_NONBLOCK,0600); if(fd==-1) { perror(debug_file_name); return 0; } - fcntl(fd,F_SETFL,O_NONBLOCK); fcntl(fd,F_SETFD,FD_CLOEXEC); break; case 'p':
_______________________________________________ lftp mailing list lftp@uniyar.ac.ru http://univ.uniyar.ac.ru/mailman/listinfo/lftp