commit 517fc67a04c91b724245b120eebf6b9156930385
parent daf81887408aace37aa123201e0d1b6b1a2774ce
Author: mulander <netprobe@gmail.com>
Date: Tue, 9 Jun 2015 01:16:05 +0200
Fix #4 Handle a file that does not exist
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/logswan.c b/src/logswan.c
@@ -56,6 +56,10 @@ int main (int argc, char *argv[]) {
printf("Processing file : %s\n\n", argv[1]);
logFile = fopen(argv[1], "r");
+ if(!logFile) {
+ perror("Can't open log file");
+ return 1;
+ }
while (fgets(lineBuffer, LINE_MAX_LENGTH, logFile) != NULL) {
/* Tokenize line */