View | Details | Raw Unified
Collapse All | Expand All

(-) attr/libattr/libattr.c (-13 / +13 lines)
 Lines 268-274   attr_list(const char *path, char *buffer Link Here 
	  attrlist_cursor_t *cursor)
	  attrlist_cursor_t *cursor)
{
{
	const char *l;
	const char *l;
	int length, count = 0;
	int length, vlength, count = 0;
	char lbuf[MAXLISTLEN];
	char lbuf[MAXLISTLEN];
	char name[MAXNAMELEN+16];
	char name[MAXNAMELEN+16];
	unsigned int start_offset, end_offset;
	unsigned int start_offset, end_offset;
 Lines 293-306   attr_list(const char *path, char *buffer Link Here 
		if (api_unconvert(name, l, flags))
		if (api_unconvert(name, l, flags))
			continue;
			continue;
		if (flags & ATTR_DONTFOLLOW)
		if (flags & ATTR_DONTFOLLOW)
			length = lgetxattr(path, l, NULL, 0);
			vlength = lgetxattr(path, l, NULL, 0);
		else
		else
			length =  getxattr(path, l, NULL, 0);
			vlength =  getxattr(path, l, NULL, 0);
		if (length < 0 && (errno == ENOATTR || errno == ENOTSUP))
		if (vlength < 0 && (errno == ENOATTR || errno == ENOTSUP))
			continue;
			continue;
		if (count++ < cursor->opaque[0])
		if (count++ < cursor->opaque[0])
			continue;
			continue;
		if (attr_list_pack(name, length, buffer, buffersize,
		if (attr_list_pack(name, vlength, buffer, buffersize,
				   &start_offset, &end_offset)) {
				   &start_offset, &end_offset)) {
			cursor->opaque[0] = count;
			cursor->opaque[0] = count;
			break;
			break;
 Lines 314-320   attr_listf(int fd, char *buffer, const i Link Here 
	   attrlist_cursor_t *cursor)
	   attrlist_cursor_t *cursor)
{
{
	const char *l;
	const char *l;
	int c, count = 0;
	int length, vlength, count = 0;
	char lbuf[MAXLISTLEN];
	char lbuf[MAXLISTLEN];
	char name[MAXNAMELEN+16];
	char name[MAXNAMELEN+16];
	unsigned int start_offset, end_offset;
	unsigned int start_offset, end_offset;
 Lines 325-346   attr_listf(int fd, char *buffer, const i Link Here 
	}
	}
	bzero(buffer, sizeof(attrlist_t));
	bzero(buffer, sizeof(attrlist_t));
	c = flistxattr(fd, lbuf, sizeof(lbuf));
	length = flistxattr(fd, lbuf, sizeof(lbuf));
	if (c < 0)
	if (length < 0)
		return c;
		return length;
	start_offset = sizeof(attrlist_t);
	start_offset = sizeof(attrlist_t);
	end_offset = buffersize & ~(8-1);	/* 8 byte align */
	end_offset = buffersize & ~(8-1);	/* 8 byte align */
	for (l = lbuf; l != lbuf + c; l = strchr(l, '\0') + 1) {
	for (l = lbuf; l != lbuf + length; l = strchr(l, '\0') + 1) {
		if (api_unconvert(name, l, flags))
		if (api_unconvert(name, l, flags))
			continue;
			continue;
		c = fgetxattr(fd, l, NULL, 0);
		vlength = fgetxattr(fd, l, NULL, 0);
		if (c < 0 && (errno == ENOATTR || errno == ENOTSUP))
		if (vlength < 0 && (errno == ENOATTR || errno == ENOTSUP))
			continue;
			continue;
		if (count++ < cursor->opaque[0])
		if (count++ < cursor->opaque[0])
			continue;
			continue;
		if (attr_list_pack(name, c, buffer, buffersize,
		if (attr_list_pack(name, vlength, buffer, buffersize,
				   &start_offset, &end_offset)) {
				   &start_offset, &end_offset)) {
			cursor->opaque[0] = count;
			cursor->opaque[0] = count;
			break;
			break;