commit 2bf3ddc7156aa95e874128c860f64f122313bfcc
parent c65e206684a90a5d04f1c3315972233cffb509c5
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Tue, 9 Jun 2015 09:04:13 +0200
Merge pull request #5 from mulander/4-fake-file
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 */