summaryrefslogtreecommitdiffstats
path: root/tail.c
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-14 16:11:26 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-12-14 16:11:26 +0100
commit3d14ba70a6e3164556a5f984bd7a183df8a1cd00 (patch)
treef773009bebb96be72aefe74525f525c1c16b53b4 /tail.c
parent6749719af90afe9544db14bdd8e2742926f1439c (diff)
downloade2tools-3d14ba70a6e3164556a5f984bd7a183df8a1cd00.tar.gz
e2tools-3d14ba70a6e3164556a5f984bd7a183df8a1cd00.tar.xz
e2tools-3d14ba70a6e3164556a5f984bd7a183df8a1cd00.zip
Make e2tools compile without warnings (Fedora)
This is Fedora's e2tools-fedora-fixes.patch
Diffstat (limited to 'tail.c')
-rw-r--r--tail.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tail.c b/tail.c
index 3bbb621..8f1a01c 100644
--- a/tail.c
+++ b/tail.c
@@ -251,7 +251,6 @@ tail(ext2_filsys *fs_ptr, ext2_ino_t root, char *input, int num_lines,
unsigned int bytes_to_read;
unsigned int bytes_read;
char *ptr;
- off_t pos;
struct ext2_inode inode;
ext2_file_t tail_fd;
ext2_off_t offset;
@@ -320,7 +319,11 @@ tail(ext2_filsys *fs_ptr, ext2_ino_t root, char *input, int num_lines,
if (bytes_to_read != bytes_read - 1)
{
ptr++;
- write(1, ptr, bytes_read - bytes_to_read - 1);
+ if (0 > write(1, ptr, bytes_read - bytes_to_read - 1))
+ {
+ perror("writing bytes to stdout");
+ return -1;
+ }
}
offset = 0; /* make sure we break out of the main loop */
break;
@@ -338,7 +341,12 @@ tail(ext2_filsys *fs_ptr, ext2_ino_t root, char *input, int num_lines,
*/
if (num_lines > 0)
- write(1, buf, bytes_read);
+ {
+ if (0 > write(1, buf, bytes_read)) {
+ perror("writing bytes to stdout");
+ return -1;
+ }
+ }
/* retreive the current position in the file */
if ((retval = ext2fs_file_lseek(tail_fd, 0, EXT2_SEEK_CUR, &cur_pos)))