1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Description: Fix FTBFS on GNU/Hurd.
Author: Svante Signell <svante.signell@gmail.com>
Author: Yavor Doganov <yavor@gnu.org
Bug-Debian: https://bugs.debian.org/767847
Forwarded: https://savannah.gnu.org/bugs/?52731
Last-Update: 2017-12-22
---
--- gworkspace.orig/GWMetadata/gmds/gmds/gmds.m
+++ gworkspace/GWMetadata/gmds/gmds/gmds.m
@@ -94,12 +94,13 @@
int newblen = strlen((const char *)newbase);
const unsigned char *oldpath = sqlite3_value_text(argv[2]);
int oldplen = strlen((const char *)oldpath);
- char newpath[PATH_MAX] = "";
+ char *newpath;
int i = newblen;
int j;
- strncpy(newpath, (const char *)newbase, newblen);
-
+ newpath = malloc(newblen + oldplen - oldblen + 1);
+ strncpy(newpath, (const char *)newbase, newblen + oldplen - oldblen + 1);
+
for (j = oldblen; j < oldplen; j++) {
newpath[i] = oldpath[j];
i++;
@@ -108,6 +109,8 @@
newpath[i] = '\0';
sqlite3_result_text(context, newpath, strlen(newpath), SQLITE_TRANSIENT);
+
+ free(newpath);
}
static void time_stamp(sqlite3_context *context, int argc, sqlite3_value **argv)
--- gworkspace.orig/GWMetadata/gmds/mdextractor/mdextractor.m
+++ gworkspace/GWMetadata/gmds/mdextractor/mdextractor.m
@@ -87,12 +87,13 @@
int newblen = strlen((const char *)newbase);
const unsigned char *oldpath = sqlite3_value_text(argv[2]);
int oldplen = strlen((const char *)oldpath);
- char newpath[PATH_MAX] = "";
+ char *newpath;
int i = newblen;
int j;
-
- strncpy(newpath, (const char *)newbase, newblen);
-
+
+ newpath = malloc(newblen + oldplen - oldblen + 1);
+ strncpy(newpath, (const char *)newbase, newblen + oldplen - oldblen + 1);
+
for (j = oldblen; j < oldplen; j++) {
newpath[i] = oldpath[j];
i++;
@@ -101,6 +102,8 @@
newpath[i] = '\0';
sqlite3_result_text(context, newpath, strlen(newpath), SQLITE_TRANSIENT);
+
+ free(newpath);
}
static void time_stamp(sqlite3_context *context, int argc, sqlite3_value **argv)
|