mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-19 02:00:06 +02:00
93 lines
2.8 KiB
Plaintext
93 lines
2.8 KiB
Plaintext
From 190f5335afd53bc243e07220fd606f673ef0126f Mon Sep 17 00:00:00 2001
|
|
From: David Karoly <david.karoly@outlook.com>
|
|
Date: Thu, 15 Dec 2022 17:36:32 +0100
|
|
Subject: adjust folders for Haiku
|
|
|
|
|
|
diff --git a/unix/storage.c b/unix/storage.c
|
|
index ca22573..df40613 100644
|
|
--- a/unix/storage.c
|
|
+++ b/unix/storage.c
|
|
@@ -20,6 +20,11 @@
|
|
#include "storage.h"
|
|
#include "tree234.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
+
|
|
#ifdef PATH_MAX
|
|
#define FNLEN PATH_MAX
|
|
#else
|
|
@@ -107,6 +112,15 @@ static char *make_filename(int index, const char *subname)
|
|
if (env && *env) {
|
|
xdg_dir = dupprintf("%s/putty", env);
|
|
}
|
|
+#ifdef __HAIKU__
|
|
+ if (!xdg_dir) {
|
|
+ char dir[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, dir, sizeof(dir)) == B_OK) {
|
|
+ xdg_dir = dupprintf("%s/putty", dir);
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
if (!xdg_dir) {
|
|
if (home) {
|
|
tmp = home;
|
|
diff --git a/unix/utils/make_dir_path.c b/unix/utils/make_dir_path.c
|
|
index 4d212fe..87b8ead 100644
|
|
--- a/unix/utils/make_dir_path.c
|
|
+++ b/unix/utils/make_dir_path.c
|
|
@@ -16,6 +16,10 @@ char *make_dir_path(const char *path, mode_t mode)
|
|
int pos = 0;
|
|
char *prefix;
|
|
|
|
+ if (mkdir(path, mode) == 0) {
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
while (1) {
|
|
pos += strcspn(path + pos, "/");
|
|
|
|
--
|
|
2.45.2
|
|
|
|
|
|
From b5dffa983d18c611bc8a4a015a703d8c2dbd0881 Mon Sep 17 00:00:00 2001
|
|
From: Chris Roberts <cpr420@gmail.com>
|
|
Date: Sat, 18 Jan 2025 21:05:35 -0700
|
|
Subject: if mkdir returns EROFS then make sure it doesn't already exist
|
|
|
|
|
|
diff --git a/unix/utils/make_dir_path.c b/unix/utils/make_dir_path.c
|
|
index 87b8ead..9fb44fb 100644
|
|
--- a/unix/utils/make_dir_path.c
|
|
+++ b/unix/utils/make_dir_path.c
|
|
@@ -26,11 +26,20 @@ char *make_dir_path(const char *path, mode_t mode)
|
|
if (pos > 0) {
|
|
prefix = dupprintf("%.*s", pos, path);
|
|
|
|
- if (mkdir(prefix, mode) < 0 && errno != EEXIST) {
|
|
+ if (mkdir(prefix, mode) < 0 && errno != EEXIST && errno != EROFS) {
|
|
char *ret = dupprintf("%s: mkdir: %s",
|
|
prefix, strerror(errno));
|
|
sfree(prefix);
|
|
return ret;
|
|
+ } else if (errno == EROFS) {
|
|
+ int original_errno = errno;
|
|
+ struct stat sb;
|
|
+ if (stat(prefix, &sb) == 0 && !S_ISDIR(sb.st_mode)) {
|
|
+ char *ret = dupprintf("%s: mkdir: %s",
|
|
+ prefix, strerror(original_errno));
|
|
+ sfree(prefix);
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
|
|
sfree(prefix);
|
|
--
|
|
2.45.2
|
|
|