mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
* fileutils/dd.c (dd_main): Ignore ftruncate error if the output is not a
file or directory.
This commit is contained in:
parent
369da77d5e
commit
eb83478528
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@ -106,9 +107,14 @@ int dd_main(int argc, char **argv)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
|
||||
if (seek && trunc) {
|
||||
if (ftruncate(ofd, seek * bs) < 0)
|
||||
if (ftruncate(ofd, seek * bs) < 0) {
|
||||
struct stat st;
|
||||
|
||||
if (fstat (ofd, &st) < 0 || S_ISREG (st.st_mode) ||
|
||||
S_ISDIR (st.st_mode))
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ofd = STDOUT_FILENO;
|
||||
outfile = "standard output";
|
||||
|
Loading…
Reference in New Issue
Block a user