[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bringing back dd's noctty flag
From: |
Paul Eggert |
Subject: |
bringing back dd's noctty flag |
Date: |
Sat, 20 Nov 2004 00:58:39 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this, as it turns out it's needed for POSIX conformance:
2004-11-20 Paul Eggert <address@hidden>
Restore dd's noctty flag, reverting the change of 2004-04-08.
POSIX does not allow "dd" to use O_NOCTTY by default.
* NEWS: Add noctty flag to dd.
* doc/coreutils.texi (dd invocation): Likewise.
* src/dd.c (flags, usage, main): Likewise.
Index: NEWS
===================================================================
RCS file: /fetish/cu/NEWS,v
retrieving revision 1.250
diff -p -u -r1.250 NEWS
--- NEWS 16 Nov 2004 07:45:15 -0000 1.250
+++ NEWS 20 Nov 2004 08:46:17 -0000
@@ -200,6 +200,7 @@ GNU coreutils NEWS
sync likewise, but also for metadata
nonblock use non-blocking I/O
nofollow do not follow symlinks
+ noctty do not assign controlling terminal from file
stty now provides support (iutf8) for setting UTF-8 input mode.
Index: doc/coreutils.texi
===================================================================
RCS file: /fetish/cu/doc/coreutils.texi,v
retrieving revision 1.227
diff -p -u -r1.227 coreutils.texi
--- doc/coreutils.texi 16 Nov 2004 20:29:58 -0000 1.227
+++ doc/coreutils.texi 20 Nov 2004 08:46:20 -0000
@@ -6832,12 +6832,20 @@ Use non-blocking I/O.
@cindex symbolic links, following
Do not follow symbolic links.
address@hidden noctty
address@hidden noctty
address@hidden controlling terminal
+Do not assign the file to be a controlling terminal for @command{dd}.
+This has no effect when the file is not a terminal.
+On many hosts (e.g., @acronym{GNU}/Linux hosts), this option has no effect
+at all.
+
@end table
These flags are not supported on all systems, and @samp{dd} rejects
attempts to use them when they are not supported. When reading from
-standard input or writing to standard output, the @samp{nofollow} flag
-should not be specified, and the other flags
+standard input or writing to standard output, the @samp{nofollow} and
address@hidden flags should not be specified, and the other flags
(e.g., @samp{nonblock}) can affect how other processes behave with the
affected file descriptors, even after @command{dd} exits.
Index: src/dd.c
===================================================================
RCS file: /fetish/cu/src/dd.c,v
retrieving revision 1.170
diff -p -u -r1.170 dd.c
--- src/dd.c 17 Nov 2004 00:56:25 -0000 1.170
+++ src/dd.c 20 Nov 2004 08:46:20 -0000
@@ -230,6 +230,7 @@ static struct symbol_value const flags[]
{"append", O_APPEND},
{"direct", O_DIRECT},
{"dsync", O_DSYNC},
+ {"noctty", O_NOCTTY},
{"nofollow", O_NOFOLLOW},
{"nonblock", O_NONBLOCK},
{"sync", O_SYNC},
@@ -431,6 +432,9 @@ Each FLAG symbol may be:\n\
fputs (_(" nonblock use non-blocking I/O\n"), stdout);
if (O_NOFOLLOW)
fputs (_(" nofollow do not follow symlinks\n"), stdout);
+ if (O_NOCTTY)
+ fputs (_(" noctty do not assign controlling terminal from file\n"),
+ stdout);
fputs (_("\
\n\
Sending a SIGUSR1 signal to a running `dd' process makes it\n\
@@ -1469,8 +1473,7 @@ main (int argc, char **argv)
}
else
{
- int opts = input_flags | O_NOCTTY;
- if (open_fd (STDIN_FILENO, input_file, O_RDONLY | opts, 0) < 0)
+ if (open_fd (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0)
error (EXIT_FAILURE, errno, _("opening %s"), quote (input_file));
}
@@ -1488,7 +1491,7 @@ main (int argc, char **argv)
{
mode_t perms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
int opts
- = (output_flags | O_NOCTTY
+ = (output_flags
| (conversions_mask & C_NOCREAT ? 0 : O_CREAT)
| (conversions_mask & C_EXCL ? O_EXCL : 0)
| (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : O_TRUNC));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bringing back dd's noctty flag,
Paul Eggert <=