diff options
author | Colin Walters <walters@verbum.org> | 2017-01-10 22:24:12 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-01-29 03:23:43 -0500 |
commit | 7be21dee4d0823dd2fe127c7a13254f960e5386a (patch) | |
tree | 6bc603c5986edc9514593a0815d2ae25a00a40c5 | |
parent | 1ac35488f1dc156c5abb0c649fb50edcf7199fac (diff) | |
download | libglnx-7be21dee4d0823dd2fe127c7a13254f960e5386a.tar.gz |
xattrs: Handle ERANGE
This is symmetric with an earlier commit which handled a transition from
`size != 0` -> `size = 0`. Now if xattrs are added we retry.
-rw-r--r-- | glnx-xattrs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/glnx-xattrs.c b/glnx-xattrs.c index c52cd0f..eadb6b1 100644 --- a/glnx-xattrs.c +++ b/glnx-xattrs.c @@ -155,6 +155,7 @@ get_xattrs_impl (const char *path, g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)")); builder_initialized = TRUE; + again: if (path) bytes_read = llistxattr (path, NULL, 0); else @@ -177,6 +178,11 @@ get_xattrs_impl (const char *path, real_size = flistxattr (fd, xattr_names, bytes_read); if (real_size < 0) { + if (errno == ERANGE) + { + g_free (xattr_names); + goto again; + } glnx_set_prefix_error_from_errno (error, "%s", "llistxattr"); goto out; } |