make everything work on freebsd

This commit is contained in:
josch
2014-12-09 09:07:47 +01:00
parent c8a0f2a942
commit 5bd9e418c4
9 changed files with 97 additions and 5 deletions

View File

@@ -21,7 +21,9 @@
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
#ifdef __linux
#include <bits/fcntl-linux.h>
#endif
#include <stdint.h>
#include <stdlib.h>

View File

@@ -17,7 +17,11 @@
*/
#define _POSIX_C_SOURCE 200809L // for strdup and struct timespec (in fuse.h)
// and S_IFDIR and S_IFREG
#define _XOPEN_SOURCE 700 // for S_IFDIR and S_IFREG (on linux,
// posix_c_source is enough but this is needed
// on freebsd)
#define FUSE_USE_VERSION 30
#include <errno.h>
#include <stdlib.h>
@@ -32,7 +36,9 @@
#include <stddef.h>
#include <pwd.h>
#include <inttypes.h>
#ifdef __linux
#include <bits/fcntl-linux.h>
#endif
#include <openssl/sha.h>
#include "hashtbl.h"

View File

@@ -29,7 +29,9 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef __linux
#include <bits/fcntl-linux.h>
#endif
#include <pwd.h>
#include <wordexp.h>
#include <fcntl.h>
@@ -349,10 +351,12 @@ static void setup_conf_and_cache_dir(struct mediafirefs_context_private *ctx)
/* EEXIST is okay, so only fail if it is something else */
if (mkdir(configdir, 0755) != 0 && errno != EEXIST) {
perror("mkdir");
fprintf(stderr, "cannot create %s\n", configdir);
exit(1);
}
if (mkdir(cachedir, 0755) != 0 && errno != EEXIST) {
perror("mkdir");
fprintf(stderr, "cannot create %s\n", cachedir);
exit(1);
}
@@ -371,6 +375,7 @@ static void setup_conf_and_cache_dir(struct mediafirefs_context_private *ctx)
ctx->filecache = strdup_printf("%s/files", cachedir);
if (mkdir(ctx->filecache, 0755) != 0 && errno != EEXIST) {
perror("mkdir");
fprintf(stderr, "cannot create %s\n", ctx->filecache);
exit(1);
}

View File

@@ -17,6 +17,9 @@
*/
#define _POSIX_C_SOURCE 200809L // for strdup and struct timespec
#define _XOPEN_SOURCE 700 // for S_IFDIR and S_IFREG (on linux,
// posix_c_source is enough but this is needed
// on freebsd)
#define FUSE_USE_VERSION 30
@@ -28,7 +31,9 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef __linux
#include <bits/fcntl-linux.h>
#endif
#include <fuse/fuse_common.h>
#include <stdint.h>
#include <libgen.h>