Skip to content
Snippets Groups Projects
Commit 9f6b2744 authored by John Hodge's avatar John Hodge
Browse files

Applications/cat - Added error check

parent d511c2fe
Branches
Tags
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g
LDFLAGS += LDFLAGS += -g
_BIN := $(OUTPUTDIR)$(DIR)/$(BIN) _BIN := $(OUTPUTDIR)$(DIR)/$(BIN)
_OBJPREFIX := obj-$(ARCH)/ _OBJPREFIX := obj-$(ARCH)/
......
...@@ -30,6 +30,7 @@ int main(int argc, char *argv[]) ...@@ -30,6 +30,7 @@ int main(int argc, char *argv[])
do { do {
num = read(fd, buf, BUF_SIZE); num = read(fd, buf, BUF_SIZE);
if(num < 0) break;
buf[num] = '\0'; buf[num] = '\0';
printf("%s", buf); printf("%s", buf);
} while(num == BUF_SIZE); } while(num == BUF_SIZE);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment