diff --git a/NEWS b/NEWS index 822146f98..da733cbd1 100644 --- a/NEWS +++ b/NEWS @@ -81,6 +81,10 @@ GNU coreutils NEWS -*- outline -*- 'pinky' will now exit immediately upon receiving a write error, which is significant when reading large plan or project files. + 'readlink' and 'realpath' will now exit promptly upon receiving a write error, + which is significant when canonicalizing multiple file names longer than + PATH_MAX. + 'timeout' on Linux will always terminate the child in the case where the timeout process itself dies, like when it receives a KILL signal for example. diff --git a/src/readlink.c b/src/readlink.c index 23f9d3b83..498826882 100644 --- a/src/readlink.c +++ b/src/readlink.c @@ -171,6 +171,8 @@ main (int argc, char **argv) if (! no_newline) putchar (use_nuls ? '\0' : '\n'); free (value); + if (ferror (stdout)) + write_error (); } else { diff --git a/src/realpath.c b/src/realpath.c index 24689a624..d6c386489 100644 --- a/src/realpath.c +++ b/src/realpath.c @@ -166,6 +166,9 @@ process_path (char const *fname, int can_mode) free (can_fname); + if (ferror (stdout)) + write_error (); + return true; }