return r;
}
+static int pakfire_mount_tmpfs(struct pakfire* pakfire, const char* path) {
+ int r;
+
+ // Mount!
+ r = mount("pakfire_root", path, "tmpfs", 0, NULL);
+ if (r) {
+ switch (errno) {
+ // We might not have permission to mount tmpfs. Ignore that...
+ case EPERM:
+ DEBUG(pakfire->ctx, "We don't have permission to mount tmpfs. Ignoring.\n");
+ return 0;
+
+ default:
+ ERROR(pakfire->ctx, "Could not mount tmpfs: %m\n");
+ return -errno;
+ }
+ }
+
+ // Umount path later
+ pakfire->internal_flags |= PAKFIRE_UMOUNT_PATH;
+
+ return 0;
+}
+
PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx* ctx,
const char* path, const char* arch, FILE* conf, int flags) {
struct pakfire* p = NULL;
// Mount a tmpfs
} else {
- r = mount("pakfire_root", path, "tmpfs", 0, NULL);
- if (r) {
- ERROR(p->ctx, "Could not mount tmpfs: %m\n");
- r = -errno;
+ r = pakfire_mount_tmpfs(p, path);
+ if (r < 0)
goto ERROR;
- }
-
- // Umount path later
- p->internal_flags |= PAKFIRE_UMOUNT_PATH;
}
}