diff options
| author | David M. Syzdek <david@syzdek.net> | 2010-01-08 13:42:32 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2010-01-08 13:42:32 -0900 |
| commit | bd05fcdf23f01db1f7003739f4f38c6abd1d5398 (patch) | |
| tree | 2392fff43ac43014550a7103bd64aaa23f989dc2 /src/bindump.c | |
| parent | bc1c8ce372154ab03a2fb6d12b2bed10bb2d28f3 (diff) | |
| download | dmstools-bd05fcdf23f01db1f7003739f4f38c6abd1d5398.tar.gz dmstools-bd05fcdf23f01db1f7003739f4f38c6abd1d5398.tar.bz2 dmstools-bd05fcdf23f01db1f7003739f4f38c6abd1d5398.tar.xz dmstools-bd05fcdf23f01db1f7003739f4f38c6abd1d5398.zip | |
Splitting my_close() and return() into two lines.
Some functions such as my_read() and my_lseek()
use the return code -1 to indicate an error which
is an invalid exit code for the main program. For
these functions the my_close() and return() calls
are on seperate lines instead of combining them
into one operation.
Diffstat (limited to 'src/bindump.c')
| -rw-r--r-- | src/bindump.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bindump.c b/src/bindump.c index c9056a0..624ceb1 100644 --- a/src/bindump.c +++ b/src/bindump.c | |||
| @@ -385,7 +385,8 @@ int my_lseek(BinDumpFile * file, size_t offset, uint32_t verbose) | |||
| 385 | if ((lseek(file->fd, (off_t)offset, SEEK_SET) == -1)) | 385 | if ((lseek(file->fd, (off_t)offset, SEEK_SET) == -1)) |
| 386 | { | 386 | { |
| 387 | perror(PROGRAM_NAME ": lseek()"); | 387 | perror(PROGRAM_NAME ": lseek()"); |
| 388 | return(my_close(file, verbose)); | 388 | my_close(file, verbose); |
| 389 | return(-1); | ||
| 389 | }; | 390 | }; |
| 390 | file->pos += offset; | 391 | file->pos += offset; |
| 391 | return(0); | 392 | return(0); |
| @@ -480,7 +481,8 @@ int my_read(BinDumpFile * file, size_t offset, size_t len, uint32_t verbose) | |||
| 480 | if ((file->code = read(file->fd, file->data, max)) == -1) | 481 | if ((file->code = read(file->fd, file->data, max)) == -1) |
| 481 | { | 482 | { |
| 482 | perror(PROGRAM_NAME ": read()"); | 483 | perror(PROGRAM_NAME ": read()"); |
| 483 | return(my_close(file, verbose)); | 484 | my_close(file, verbose); |
| 485 | return(-1); | ||
| 484 | }; | 486 | }; |
| 485 | 487 | ||
| 486 | if (file->code < 1) | 488 | if (file->code < 1) |
