pkgsrc/filesystems/glusterfs/patches/patch-bc
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

60 lines
1.9 KiB
Text

$NetBSD: patch-bc,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/quick-read/src/quick-read.c.orig 2011-04-22 19:37:28.000000000 +0200
+++ xlators/performance/quick-read/src/quick-read.c 2011-05-19 12:44:01.000000000 +0200
@@ -80,8 +80,9 @@
qr_loc_fill (loc_t *loc, inode_t *inode, char *path)
{
int32_t ret = -1;
char *parent = NULL;
+ char *path_copy = NULL;
GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", loc, out, errno, EINVAL);
GF_VALIDATE_OR_GOTO_WITH_ERROR ("quick-read", inode, out, errno,
EINVAL);
@@ -92,15 +93,15 @@
loc->inode = inode_ref (inode);
loc->path = gf_strdup (path);
loc->ino = inode->ino;
- parent = gf_strdup (path);
- if (parent == NULL) {
+ path_copy = gf_strdup (path);
+ if (path_copy == NULL) {
ret = -1;
goto out;
}
- parent = dirname (parent);
+ parent = dirname (path_copy);
loc->parent = inode_from_path (inode->table, parent);
if (loc->parent == NULL) {
ret = -1;
@@ -116,10 +117,10 @@
if (ret == -1) {
qr_loc_wipe (loc);
}
- if (parent) {
- GF_FREE (parent);
+ if (path_copy) {
+ GF_FREE (path_copy);
}
return ret;
}