summaryrefslogtreecommitdiff
path: root/getfattr
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2002-02-25 22:27:02 +0000
committerNathan Scott <nathans@sgi.com>2002-02-25 22:27:02 +0000
commit1e3a6254eaa8082cd387921f9f1a182314d52d5a (patch)
tree1dfb24128410c7f69a20ba07c4599f2a9b24af64 /getfattr
parentcb47a0b5bfc507698c67c8474610f451b0a54e3b (diff)
downloadattr-1e3a6254eaa8082cd387921f9f1a182314d52d5a.tar.gz
Undoes mod: xfs-cmds-2.4.18:slinx:111335a
Merge of xfs-cmds-2.4.18:slinx:111337a by nathans.
Diffstat (limited to 'getfattr')
-rw-r--r--getfattr/getfattr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
index 2f08392..45e9161 100644
--- a/getfattr/getfattr.c
+++ b/getfattr/getfattr.c
@@ -183,15 +183,15 @@ int do_listxattr(const char *path, char *list, size_t size)
int high_water_alloc(void **buf, int *bufsize, int newsize)
{
+#define CHUNK_SIZE 256
/*
* Goal here is to avoid unnecessary memory allocations by
* using static buffers which only grow when necessary.
* Size is increased in fixed size chunks (CHUNK_SIZE).
*/
-#define CHUNK_SIZE 256
- if (bufsize < newsize) {
+ if (*bufsize < newsize) {
newsize = (newsize + CHUNK_SIZE-1) & ~(CHUNK_SIZE-1);
- *buf = realloc(newsize);
+ *buf = realloc(*buf, newsize);
if (!*buf) {
perror(progname);
had_errors++;
@@ -227,7 +227,7 @@ int do_get_all(const char *path, struct stat *stat, void *dummy)
return 1;
}
} else if (listsize > 0) {
- if (high_water_alloc(&list, &bufsize, listsize))
+ if (high_water_alloc((void **)&list, &bufsize, listsize))
return 1;
listsize = do_listxattr(path, list, bufsize);
@@ -242,7 +242,7 @@ int do_get_all(const char *path, struct stat *stat, void *dummy)
count++;
if (count) {
n = count * sizeof(char *);
- if (high_water_alloc(&names, &ncount, n))
+ if (high_water_alloc((void **)&names, &ncount, n))
return 1;
n = 0;
for (v = list; v - list <= listsize; v += strlen(v)+1)
@@ -294,7 +294,7 @@ syscall_failed:
fprintf(stderr, "%s: %s: %s\n", path, name, strerr);
return 1;
}
- if (high_water_alloc(&value, &vsize, error + 1))
+ if (high_water_alloc((void **)&value, &vsize, error + 1))
return 1;
error = do_getxattr(path, name, value, vsize);
if (error < 0)