diff options
Diffstat (limited to 'libbb/opendir.c')
-rw-r--r-- | libbb/opendir.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libbb/opendir.c b/libbb/opendir.c new file mode 100644 index 000000000..e284db0db --- /dev/null +++ b/libbb/opendir.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * wrapper for opendir() | ||
4 | * | ||
5 | * Copyright (C) 2006 Bernhard Fischer <busybox@busybox.net> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
8 | */ | ||
9 | |||
10 | #include <sys/types.h> | ||
11 | #include <dirent.h> | ||
12 | #include "libbb.h" | ||
13 | |||
14 | #ifdef L_bb_opendir | ||
15 | DIR *bb_opendir(const char *path) | ||
16 | { | ||
17 | DIR *dp; | ||
18 | |||
19 | if ((dp = opendir(path)) == NULL) { | ||
20 | bb_perror_msg("unable to open `%s'", path); | ||
21 | return NULL; | ||
22 | } | ||
23 | return dp; | ||
24 | } | ||
25 | #endif | ||
26 | |||
27 | #ifdef L_bb_xopendir | ||
28 | DIR *bb_xopendir(const char *path) | ||
29 | { | ||
30 | DIR *dp; | ||
31 | |||
32 | if ((dp = opendir(path)) == NULL) { | ||
33 | bb_perror_msg_and_die("unable to open `%s'", path); | ||
34 | } | ||
35 | return dp; | ||
36 | } | ||
37 | #endif | ||