X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=libopkg%2Ffile_util.c;h=c54903c30b66907d126cd6ebb5ed0b58759e0f34;hp=cf5f7740e2bed43896575bde18d91fe15ccbb688;hb=733eb7729491810c346bbbecd31051ecc118fd82;hpb=0a4946b3e913a2affe5fd342aa88e2533d06356e diff --git a/libopkg/file_util.c b/libopkg/file_util.c index cf5f774..c54903c 100644 --- a/libopkg/file_util.c +++ b/libopkg/file_util.c @@ -26,7 +26,9 @@ #include "sprintf_alloc.h" #include "file_util.h" +#ifdef HAVE_MD5 #include "md5.h" +#endif #include "libbb/libbb.h" #if defined HAVE_SHA256 @@ -135,6 +137,7 @@ file_mkdir_hier(const char *path, long mode) return make_directory(path, mode, FILEUTILS_RECUR); } +#ifdef HAVE_MD5 char *file_md5sum_alloc(const char *file_name) { static const int md5sum_bin_len = 16; @@ -180,6 +183,7 @@ char *file_md5sum_alloc(const char *file_name) return md5sum_hex; } +#endif #ifdef HAVE_SHA256 char *file_sha256sum_alloc(const char *file_name) @@ -238,6 +242,11 @@ rm_r(const char *path) DIR *dir; struct dirent *dent; + if (path == NULL) { + opkg_perror(ERROR, "Missing directory parameter"); + return -1; + } + dir = opendir(path); if (dir == NULL) { opkg_perror(ERROR, "Failed to open dir %s", path);