diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
commit | 71cd8e3a743046573744123777061b64881bf372 (patch) | |
tree | 82522befe647f4fff186a5630cad0cad33f8ef53 /src/stdbuf.c | |
parent | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff) | |
download | coreutils-upstream.tar.gz |
Imported Upstream version 8.24upstream/8.24upstream
Diffstat (limited to 'src/stdbuf.c')
-rw-r--r-- | src/stdbuf.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/stdbuf.c b/src/stdbuf.c index 92ee2826..116619d7 100644 --- a/src/stdbuf.c +++ b/src/stdbuf.c @@ -1,5 +1,5 @@ /* stdbuf -- setup the standard streams for a command - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ parse_size (char const *str, size_t *size) { uintmax_t tmp_size; enum strtol_error e = xstrtoumax (str, NULL, 10, &tmp_size, "EGkKMPTYZ0"); - if (e == LONGINT_OK && tmp_size > SIZE_MAX) + if (e == LONGINT_OK && SIZE_MAX < tmp_size) e = LONGINT_OVERFLOW; if (e == LONGINT_OK) @@ -76,7 +76,7 @@ parse_size (char const *str, size_t *size) return 0; } - errno = (e == LONGINT_OVERFLOW ? EOVERFLOW : 0); + errno = (e == LONGINT_OVERFLOW ? EOVERFLOW : errno); return -1; } @@ -115,11 +115,11 @@ size set to MODE bytes.\n\ "), stdout); fputs (_("\n\ NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does\n\ -for e.g.) then that will override corresponding settings changed by 'stdbuf'.\n\ +for example) then that will override corresponding changes by 'stdbuf'.\n\ Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O,\n\ and are thus unaffected by 'stdbuf' settings.\n\ "), stdout); - emit_ancillary_info (); + emit_ancillary_info (PROGRAM_NAME); } exit (status); } @@ -256,7 +256,7 @@ set_LD_PRELOAD (void) ret = putenv (LD_PRELOAD); #ifdef __APPLE__ if (ret == 0) - ret = putenv ("DYLD_FORCE_FLAT_NAMESPACE=y"); + ret = setenv ("DYLD_FORCE_FLAT_NAMESPACE", "y", 1); #endif if (ret != 0) @@ -387,9 +387,7 @@ main (int argc, char **argv) execvp (*argv, argv); - { - int exit_status = (errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE); - error (0, errno, _("failed to run command %s"), quote (argv[0])); - exit (exit_status); - } + int exit_status = errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; + error (0, errno, _("failed to run command %s"), quote (argv[0])); + return exit_status; } |