diff --git a/haiku-libs/libprefs/libprefs-1.2.5.recipe b/haiku-libs/libprefs/libprefs-1.2.5.recipe index 5d6e0bcba..de1721a3d 100644 --- a/haiku-libs/libprefs/libprefs-1.2.5.recipe +++ b/haiku-libs/libprefs/libprefs-1.2.5.recipe @@ -8,14 +8,14 @@ is." HOMEPAGE="http://ftp.icm.edu.pl/pub/beos/contrib/libraries/" COPYRIGHT="1998 Jon Watte" LICENSE="Public Domain" -REVISION="2" +REVISION="3" SOURCE_URI="http://ftp.icm.edu.pl/pub/beos/contrib/libraries/libprefs125.zip" CHECKSUM_SHA256="39532c9c6c69f915a6d99fde4fd827a5bdb676ee0cf00558b6956fc91db9a737" SOURCE_DIR="libprefs125" -PATCHES="libprefs-1.2.5.patch" +PATCHES="libprefs-1.2.5.patchset" ARCHITECTURES="x86_gcc2 !x86 !x86_64" -SECONDARY_ARCHITECTURES="x86_gcc2 !x86" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" PROVIDES=" libprefs$secondaryArchSuffix = $portVersion diff --git a/haiku-libs/libprefs/patches/libprefs-1.2.5.patch b/haiku-libs/libprefs/patches/libprefs-1.2.5.patch deleted file mode 100644 index a08e04b42..000000000 --- a/haiku-libs/libprefs/patches/libprefs-1.2.5.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff --git a/src/libprefs.cpp b/src/libprefs.cpp -index da58013..90d0aa4 100644 ---- a/src/libprefs.cpp -+++ b/src/libprefs.cpp -@@ -71,6 +71,7 @@ - #include - #endif - -+#include - - /* identifier for this implementation of the prefs library */ - #define PREF_VERSION_STRING "simple libprefs.so version 1.2.4" -@@ -435,7 +436,7 @@ _PREFMakePath( - { - status_t err = B_OK; - BPath bpath; -- err = find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL); -+ err = find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL); - if (err < B_OK) return err; - strncpy(path, bpath.Path(), path_max); - path[path_max-1] = 0; -@@ -894,9 +895,9 @@ PREFReloadSet(PREFData data) - #if DEBUG - printf("reload read %d\n", rd); - #endif -+ char * buffer = (char *)malloc(size); - if (rd < 0) { err = rd; goto cleanup; } - if (rd != sizeof(size)) { err = B_ERROR; goto cleanup; } -- char * buffer = (char *)malloc(size); - if (buffer == NULL) { err = B_NO_MEMORY; goto cleanup; } - rd = read(data->transaction->fd, buffer, size); - #if DEBUG -@@ -1156,7 +1157,7 @@ typedef struct _PREFAppIterator { - curItem = 0; - item = new char*[block]; - BPath bpath; -- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL)) -+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL)) - { - BDirectory dir(bpath.Path()); - BEntry entry; -@@ -1278,7 +1279,7 @@ typedef struct _PREFSetIterator - curItem = 0; - item = new char*[block]; - BPath bpath; -- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL)) -+ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL)) - { - char str[B_FILE_NAME_LENGTH+20]; - strcpy(str, LP_MAGIC); diff --git a/haiku-libs/libprefs/patches/libprefs-1.2.5.patchset b/haiku-libs/libprefs/patches/libprefs-1.2.5.patchset new file mode 100644 index 000000000..8bb40cccd --- /dev/null +++ b/haiku-libs/libprefs/patches/libprefs-1.2.5.patchset @@ -0,0 +1,111 @@ +From f8807bd4979b9ddd718100bf5af2e18228c84a8c Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 10 Mar 2019 16:47:58 +0100 +Subject: applying patch libprefs-1.2.5.patch + + +diff --git a/src/libprefs.cpp b/src/libprefs.cpp +index da58013..90d0aa4 100644 +--- a/src/libprefs.cpp ++++ b/src/libprefs.cpp +@@ -71,6 +71,7 @@ + #include + #endif + ++#include + + /* identifier for this implementation of the prefs library */ + #define PREF_VERSION_STRING "simple libprefs.so version 1.2.4" +@@ -435,7 +436,7 @@ _PREFMakePath( + { + status_t err = B_OK; + BPath bpath; +- err = find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL); ++ err = find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL); + if (err < B_OK) return err; + strncpy(path, bpath.Path(), path_max); + path[path_max-1] = 0; +@@ -894,9 +895,9 @@ PREFReloadSet(PREFData data) + #if DEBUG + printf("reload read %d\n", rd); + #endif ++ char * buffer = (char *)malloc(size); + if (rd < 0) { err = rd; goto cleanup; } + if (rd != sizeof(size)) { err = B_ERROR; goto cleanup; } +- char * buffer = (char *)malloc(size); + if (buffer == NULL) { err = B_NO_MEMORY; goto cleanup; } + rd = read(data->transaction->fd, buffer, size); + #if DEBUG +@@ -1156,7 +1157,7 @@ typedef struct _PREFAppIterator { + curItem = 0; + item = new char*[block]; + BPath bpath; +- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL)) ++ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL)) + { + BDirectory dir(bpath.Path()); + BEntry entry; +@@ -1278,7 +1279,7 @@ typedef struct _PREFSetIterator + curItem = 0; + item = new char*[block]; + BPath bpath; +- if (!find_directory(user_level ? B_USER_SETTINGS_DIRECTORY : B_COMMON_SETTINGS_DIRECTORY, &bpath, true, NULL)) ++ if (!find_directory(B_USER_SETTINGS_DIRECTORY, &bpath, true, NULL)) + { + char str[B_FILE_NAME_LENGTH+20]; + strcpy(str, LP_MAGIC); +-- +2.19.1 + + +From 3337f96a5487660f97dc1a51f17dbfd2b067e3e1 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Sun, 10 Mar 2019 18:26:34 +0100 +Subject: Remove non-existant syscall. + + +diff --git a/src/libprefs.cpp b/src/libprefs.cpp +index 90d0aa4..50cd31d 100644 +--- a/src/libprefs.cpp ++++ b/src/libprefs.cpp +@@ -83,11 +83,6 @@ long long POLL_INTERVAL = 9000000; /* nine seconds */ + /* COMMON_DIRNAME is used to disambigue the case where user folder == common folder */ + #define COMMON_DIRNAME "(libprefs common)" + +-/* some magic system calls */ +-extern "C" int _klock_node_(int fd); +-extern "C" int _kunlock_node_(int fd); +- +- + /* changes allowing hierarchical sets */ + #define PRE_121 0 + +@@ -1525,7 +1520,7 @@ PREFBeginTransaction( + release_sem(fTransSem); + /* open and lock file */ + open_again: +- int fd = open(data->prefs, O_RDWR | O_CREAT, 0666); ++ int fd = open(data->prefs, O_RDWR | O_CREAT | O_EXCL, 0666); + #if DEBUG + printf("open %s returns %d\n", data->prefs, fd); + #endif +@@ -1534,16 +1529,6 @@ open_again: + if (fd < 0) printf("errno = %08x\n", errno); + #endif + if ((fd < 0) && (errno != EBUSY)) return fd; +- if ((fd < 0) || (_klock_node_(fd) < B_OK)) +- { /* it is unfortunate that there is no atomic/blocking way to wait */ +- /* for exclusive access to a file - now we are forces to busy-wait */ +- if (fd >= 0) close(fd); +-#if DEBUG +- printf("can't lock - snoozing\n", fd); +-#endif +- snooze((rand()&0x7fff)+(find_thread(NULL)&0x7fff)+10000); // random snooze time to break ties +- goto open_again; +- } + /* acquire transaction semaphore - this will always work, */ + /* because the transaction semaphore is never held across blocking system calls */ + acquire_sem(fTransSem); +-- +2.19.1 +