summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-03-25 23:38:00 +0000
committerJim Meyering <jim@meyering.net>1994-03-25 23:38:00 +0000
commit8bf5a6ed183fe03026e0f24b751a8303860c2d55 (patch)
treef3b7990388d4762e89c6f1cbf6580dbe30cee2aa /src/od.c
parent8bcd22c5104e44227dccd458e6e50940d9e9a462 (diff)
downloadcoreutils-8bf5a6ed183fe03026e0f24b751a8303860c2d55.tar.xz
.
Diffstat (limited to 'src/od.c')
-rw-r--r--src/od.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/od.c b/src/od.c
index 35d1cdd0f..d03ff342a 100644
--- a/src/od.c
+++ b/src/od.c
@@ -1040,9 +1040,10 @@ decode_format_string (s)
/* Given a list of one or more input filenames FILE_LIST, set the global
file pointer IN_STREAM to position N_SKIP in the concatenation of
those files. If any file operation fails or if there are fewer than
- N_SKIP bytes in the combined input, give an error message and exit.
- When possible, use seek- rather than read operations to advance
- IN_STREAM. A file name of "-" is interpreted as standard input. */
+ N_SKIP bytes in the combined input, give an error message and return
+ non-zero. When possible, use seek- rather than read operations to
+ advance IN_STREAM. A file name of "-" is interpreted as standard
+ input. */
static int
skip (n_skip)
@@ -1495,6 +1496,10 @@ dump ()
size_t n_bytes_read;
size_t end_offset;
+#ifdef lint /* Suppress `used before initialized' warning. */
+ end_offset = 0;
+#endif
+
block[0] = (char *) alloca (bytes_per_block);
block[1] = (char *) alloca (bytes_per_block);
@@ -1702,6 +1707,10 @@ main (argc, argv)
after any true address. */
long int pseudo_start;
+#ifdef lint /* Suppress `used before initialized' warning. */
+ pseudo_start = 0;
+#endif
+
program_name = argv[0];
err = 0;
@@ -1993,6 +2002,8 @@ main (argc, argv)
}
err |= skip (n_bytes_to_skip);
+ if (in_stream == NULL)
+ goto cleanup;
pseudo_offset = (flag_pseudo_start ? pseudo_start - n_bytes_to_skip : 0);
@@ -2028,6 +2039,8 @@ main (argc, argv)
err |= (flag_dump_strings ? dump_strings () : dump ());
+cleanup:;
+
if (have_read_stdin && fclose (stdin) == EOF)
error (2, errno, "standard input");