Index: uspace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 582a0b84b0a73672531e7b404a89997af41ba0b9)
+++ uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 82d515e917f3eeeff253e4aa30e493f5f632c950)
@@ -180,10 +180,12 @@
     off64_t head, off64_t tail, bool tail_first)
 {
-	int fd, bytes = 0, count = 0, reads = 0;
+	int fd, count = 0, reads = 0;
+	size_t bytes;
 	char *buff = NULL;
-	int i;
+	size_t i;
 	size_t offset = 0, copied_bytes = 0;
 	off64_t file_size = 0, length = 0;
 	aoff64_t pos = 0;
+	int rc;
 
 	bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
@@ -250,8 +252,9 @@
 		}
 		
-		bytes = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read);
+		rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read,
+		    &bytes);
 		copied_bytes = 0;
 
-		if (bytes > 0) {
+		if (rc == EOK && bytes > 0) {
 			buff[bytes] = '\0';
 			offset = 0;
@@ -284,8 +287,8 @@
 		if (reading_stdin)
 			fflush(stdout);
-	} while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
+	} while (rc == EOK && bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
 
 	vfs_put(fd);
-	if (bytes == -1) {
+	if (rc != EOK) {
 		printf("Error reading %s\n", fname);
 		free(buff);
