X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=utils%2Futils.c;h=e239eda5110ec4e38b88880d7b7d24341389e85e;hp=ebf5447c8dad94245a91e1749e9f1887cd3f8c94;hb=8d720b2c2e569885c6e1e7eab68d36f31818ed84;hpb=9f3b9ddf1a94b03e463f5354b48808a9f05d38bb diff --git a/utils/utils.c b/utils/utils.c index ebf5447..e239eda 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -12,6 +12,7 @@ * GNU General Public License for more details. */ +#define _GNU_SOURCE #include #include #include "utils.h" @@ -25,6 +26,10 @@ #include "../log.h" +#ifndef O_PATH +#define O_PATH 010000000 +#endif + void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len, blobmsg_list_cmp cmp) { @@ -165,7 +170,7 @@ int patch_fd(const char *device, int fd, int flags) device = "/dev/null"; if (*device != '/') { - dfd = open("/dev", O_RDONLY); + dfd = open("/dev", O_PATH|O_DIRECTORY); if (dfd < 0) return -1;