all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 1ceea1221d9534aebe3116f59f77ee87232a5521 1889 bytes (raw)
name: gnu/packages/patches/fontconfig-path-max.patch 	 # note: path name is non-authoritative(*)

  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
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
 
The patch replaces the use of macro PATH_MAX, in default.c and
fcstat.c files.
---
 src/fcdefault.c | 32 +++++++++++++++++++++++++-------
 src/fcstat.c    | 28 +++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/src/fcdefault.c b/src/fcdefault.c
index 6647a8f..4856777 100644
--- a/src/fcdefault.c
+++ b/src/fcdefault.c
@@ -150,15 +150,33 @@ retry:
 # if defined (HAVE_GETEXECNAME)
 	const char *p = getexecname ();
 # elif defined (HAVE_READLINK)
-	char buf[PATH_MAX + 1];
-	int len;
+	int size = 128;
 	char *p = NULL;
 
-	len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
-	if (len != -1)
-	{
-	    buf[len] = '\0';
-	    p = buf;
+	while (1) {
+	    char *buf = malloc (size);
+	    int len;
+
+	    if (buf == NULL)
+		break;
+
+	    len = readlink ("/proc/self/exe", buf, size - 1);
+
+	    if (len < 0)
+	    {
+		free(buf);
+		break;
+	    }
+
+	    if (len < size - 1)
+	    {
+		buf[len] = '\0';
+		p = buf;
+		break;
+	    }
+
+	    free (buf);
+	    size *= 2;
 	}
 # else
 	char *p = NULL;
diff --git a/src/fcstat.c b/src/fcstat.c
index 1734fa4..b2a5ddb 100644
--- a/src/fcstat.c
+++ b/src/fcstat.c
@@ -278,17 +278,35 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
 	{
 #endif
 	struct stat statb;
-	char f[PATH_MAX + 1];
+	int size = 128;
+	char *f = malloc (size);
 
-	memcpy (f, dir, len);
-	f[len] = FC_DIR_SEPARATOR;
-	memcpy (&f[len + 1], files[n]->d_name, dlen);
-	f[len + 1 + dlen] = 0;
+	if (f == NULL)
+	    break;
+
+	if (len < 0)
+	{
+	    free(f);
+	    break;
+	}
+	
+	if (len < size - 1)
+	{
+	    memcpy (f, dir, len);
+	    f[len] = FC_DIR_SEPARATOR;
+	    memcpy (&f[len + 1], files[n]->d_name, dlen);
+	    f[len + 1 + dlen] = 0;
+	}
+	
 	if (lstat (f, &statb) < 0)
 	{
 	    ret = -1;
 	    goto bail;
 	}
+
+	free (f);
+	size *= 2;
+
 	if (S_ISDIR (statb.st_mode))
 	    goto bail;
 
-- 
2.6.3


debug log:

solving 1ceea12 ...
found 1ceea12 in https://yhetil.org/guix/328a872d39b4913fa06c623e24838363@openmailbox.org/

applying [1/1] https://yhetil.org/guix/328a872d39b4913fa06c623e24838363@openmailbox.org/
diff --git a/gnu/packages/patches/fontconfig-path-max.patch b/gnu/packages/patches/fontconfig-path-max.patch
new file mode 100644
index 0000000..1ceea12

1:20: space before tab in indent.
 	const char *p = getexecname ();
1:25: space before tab in indent.
 	char *p = NULL;
1:26: trailing whitespace.
 
1:56: space before tab in indent.
 	}
1:58: space before tab in indent.
 	char *p = NULL;
Checking patch gnu/packages/patches/fontconfig-path-max.patch...
Applied patch gnu/packages/patches/fontconfig-path-max.patch cleanly.
warning: squelched 15 whitespace errors
warning: 20 lines add whitespace errors.

index at:
100644 1ceea1221d9534aebe3116f59f77ee87232a5521	gnu/packages/patches/fontconfig-path-max.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.