MCPcopy Create free account
hub / github.com/RsyncProject/rsync / get_xattr_names

Function get_xattr_names

xattrs.c:144–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static ssize_t get_xattr_names(const char *fname)
145{
146 ssize_t list_len;
147 int64 arg;
148
149 if (!namebuf) {
150 namebuf_len = 1024;
151 namebuf = new_array(char, namebuf_len);
152 }
153
154 while (1) {
155 /* The length returned includes all the '\0' terminators. */
156 list_len = sys_llistxattr(fname, namebuf, namebuf_len);
157 if (list_len >= 0) {
158 if ((size_t)list_len <= namebuf_len)
159 break;
160 } else if (errno == ENOTSUP)
161 return 0;
162 else if (errno != ERANGE) {
163 arg = namebuf_len;
164 got_error:
165 rsyserr(FERROR_XFER, errno,
166 "get_xattr_names: llistxattr(%s,%s) failed",
167 full_fname(fname), big_num(arg));
168 return -1;
169 }
170 list_len = sys_llistxattr(fname, NULL, 0);
171 if (list_len < 0) {
172 arg = 0;
173 goto got_error;
174 }
175 if (namebuf_len)
176 free(namebuf);
177 namebuf_len = list_len + 1024;
178 namebuf = new_array(char, namebuf_len);
179 }
180
181 return list_len;
182}
183
184/* On entry, the *len_ptr parameter contains the size of the extra space we
185 * should allocate when we create a buffer for the data. On exit, it contains

Callers 3

rsync_xal_getFunction · 0.85
copy_xattrsFunction · 0.85
rsync_xal_setFunction · 0.85

Calls 4

sys_llistxattrFunction · 0.85
full_fnameFunction · 0.85
big_numFunction · 0.85
rsyserrFunction · 0.70

Tested by

no test coverage detected