b3de6cf9da
MiniDLNA is lightweight server software written in C, capable of serving media files to DLNA/UPnP-AV clients (televisions, tablets, etc).
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
$OpenBSD: patch-utils_c,v 1.1.1.1 2012/10/10 10:45:05 sthen Exp $
|
|
|
|
avoid mkdir /, from freebsd ports
|
|
|
|
--- utils.c.orig Tue Feb 14 18:26:53 2012
|
|
+++ utils.c Sat Sep 22 02:48:43 2012
|
|
@@ -19,7 +19,7 @@
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
-#include <linux/limits.h>
|
|
+#include <sys/syslimits.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
@@ -253,13 +253,17 @@ make_dir(char * path, mode_t mode)
|
|
++s;
|
|
}
|
|
|
|
- if (mkdir(path, mode) < 0) {
|
|
+ if (!(path[0] == '/' && s == path + 1) /* skip "/" */
|
|
+ && mkdir(path, mode) < 0) {
|
|
+ int e = errno;
|
|
/* If we failed for any other reason than the directory
|
|
* already exists, output a diagnostic and return -1.*/
|
|
if (errno != EEXIST || (stat(path, &st) < 0 || !S_ISDIR(st.st_mode))) {
|
|
- DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot create directory '%s'\n", path);
|
|
if (c)
|
|
*s = c;
|
|
+ DPRINTF(E_WARN, L_GENERAL, "make_dir: cannot "
|
|
+ "create directory '%.*s' (to create %s): "
|
|
+ "%s\n", s - path, path, path, strerror(e));
|
|
return -1;
|
|
}
|
|
}
|