bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dd killed with USR1 right after ftruncate()


From: Voelker, Bernhard
Subject: dd killed with USR1 right after ftruncate()
Date: Wed, 12 Aug 2009 16:30:17 +0200

Hi *,
 
short question:
is there a particular reason why the signal handlers are installed after 
ftruncate() in dd?
 
Long story:
I ran dd for a new backup of my 150GB partition to an external USB drive while 
I started
    while kill -USR1 pid ; do sleep 30 ; done
in a separate terminal. The target file already existed and reflected a 
previous backup.
After a while, dd ended with the standard USR1 signal handler.
The only work done so far was to truncate the old output file.
So my guess was that installing the signal handler for SIGUSR1 is done after
the truncation. So I looked into the latest sources (coreutils-7.4) and found 
out
that my guess was right:
 
       if (ftruncate (STDOUT_FILENO, size) != 0)
         {
    <snipped />
         }
     }
    #endif
      }
      install_signal_handlers ();
 
So why does ftruncate() before install_signal_handlers()?
 
Thank you & have a nice day,
Berny




reply via email to

[Prev in Thread] Current Thread [Next in Thread]