pkgsrc/filesystems/glusterfs/patches/patch-ba
manu 8cc50c73f8 Update glusterfs to 3.2. According to http://www.gluster.org, news are:
* Geo-Replication
* Easily Accessible Usage Quotas
* Advanced Monitoring Tools
2011-05-19 14:54:22 +00:00

45 lines
1.4 KiB
Text

$NetBSD: patch-ba,v 1.3 2011/05/19 14:54:23 manu Exp $
glibc dirname() modify the string it is given and returns it.
glusterfs takes this behavior for granted, and assume that if it
gives a malloc'ed string to dirname(), then it can free()) the
return value.
Here is what SUSv2 says:
http://opengroup.org/onlinepubs/007908799/xsh/dirname.html
"The dirname() function may modify the string pointed to by path,
and may return a pointer to static storage"
At least NetBSD returns a static storage. glusterfs will return it to
a calling function that has the responsability to free it, causing
a SIGSEGV.
--- xlators/performance/stat-prefetch/src/stat-prefetch.c.orig 2011-04-22 19:37:28.000000000 +0200
+++ xlators/performance/stat-prefetch/src/stat-prefetch.c 2011-05-19 12:41:28.000000000 +0200
@@ -949,18 +949,24 @@
path = dirname (cpy);
switch (i)
{
case 0:
- *parent = path;
+ *parent = gf_strdup (path);
+ if (*parent == NULL)
+ goto out;
break;
case 1:
- *grand_parent = path;
+ *grand_parent = gf_strdup (path);
+ if (*grand_parent == NULL)
+ goto out;
break;
}
}
ret = 0;
out:
+ if (cpy != NULL)
+ GF_FREE(cpy);
return ret;
}