about summary refs log tree commit diff
path: root/list.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-18 17:06:41 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-18 17:06:41 +0200
commit22f456a2a02d2b8b4b6fb4da9927683bc5d4a29f (patch)
treefac7537e31634d146cc65f96344d81fbfbaacbcb /list.c
parent4babc3e95acc89e5e483c1ee5050272454eccfdc (diff)
downloadmblaze-22f456a2a02d2b8b4b6fb4da9927683bc5d4a29f.tar.gz
mblaze-22f456a2a02d2b8b4b6fb4da9927683bc5d4a29f.tar.xz
mblaze-22f456a2a02d2b8b4b6fb4da9927683bc5d4a29f.zip
clean up header includes
Diffstat (limited to 'list.c')
-rw-r--r--list.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/list.c b/list.c
index 2a115c8..689743b 100644
--- a/list.c
+++ b/list.c
@@ -1,17 +1,16 @@
 #define _GNU_SOURCE
-#include <dirent.h>     /* Defines DT_* constants */
+
+#include <sys/stat.h>
+#include <sys/syscall.h>
+
+#include <dirent.h>
 #include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/syscall.h>
-#include <stdint.h>
-#include <limits.h>
-
-#define handle_error(msg)					\
-	do { perror(msg); exit(EXIT_FAILURE); } while (0)
 
 #define lc(c) ((c) | 0x20)
 #define uc(c) ((c) & 0xdf)
@@ -115,8 +114,10 @@ listdir(char *dir)
 	
 	while (1) {
 		nread = syscall(SYS_getdents64, fd, buf, BUF_SIZE);
-		if (nread == -1)
-			handle_error("getdents64");
+		if (nread == -1) {
+			perror("getdents64");
+			break;
+		}
 		
 		if (nread == 0)
 			break;