The Samba-Bugzilla – Attachment 8119 Details for
Bug 9338
libreplace does not replace getxattr correctly for 0 length semantics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
lib/replace getxattr patch from master
0001-lib-replace-Return-size-of-xattr-if-size-argument-is.patch (text/plain), 2.08 KB, created by
Andrew Bartlett
on 2012-10-30 06:28:21 UTC
(
hide
)
Description:
lib/replace getxattr patch from master
Filename:
MIME Type:
Creator:
Andrew Bartlett
Created:
2012-10-30 06:28:21 UTC
Size:
2.08 KB
patch
obsolete
>From 2756c3ce5c7d5d066dc76592dd1078a8594b983b Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Sat, 27 Oct 2012 19:15:58 +1100 >Subject: [PATCH] lib/replace: Return size of xattr if size argument is 0 > >This makes rep_{f,}getxattr a more complete replacement for the linux function. > >Andrew Bartlett >--- > lib/replace/xattr.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/lib/replace/xattr.c b/lib/replace/xattr.c >index 8e1c989..a26ff67 100644 >--- a/lib/replace/xattr.c >+++ b/lib/replace/xattr.c >@@ -71,7 +71,9 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si > * that the buffer is large enough to fit the returned value. > */ > if((retval=extattr_get_file(path, attrnamespace, attrname, NULL, 0)) >= 0) { >- if(retval > size) { >+ if (size == 0) { >+ return retval; >+ } else if (retval > size) { > errno = ERANGE; > return -1; > } >@@ -88,6 +90,9 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si > if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT; > > retval = attr_get(path, attrname, (char *)value, &valuelength, flags); >+ if (size == 0 && retval == -1 && errno == E2BIG) { >+ return valuelength; >+ } > > return retval ? retval : valuelength; > #elif defined(HAVE_ATTROPEN) >@@ -126,7 +131,9 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size) > const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; > > if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) { >- if(retval > size) { >+ if (size == 0) { >+ return retval; >+ } else if (retval > size) { > errno = ERANGE; > return -1; > } >@@ -143,7 +150,9 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size) > if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT; > > retval = attr_getf(filedes, attrname, (char *)value, &valuelength, flags); >- >+ if (size == 0 && retval == -1 && errno == E2BIG) { >+ return valuelength; >+ } > return retval ? retval : valuelength; > #elif defined(HAVE_ATTROPEN) > ssize_t ret = -1; >-- >1.7.11.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 9338
: 8119