src/server/webdav/xattrbackend.c

changeset 483
f69d88f86b9c
parent 482
b02da778362e
child 484
c036a8b242a8
equal deleted inserted replaced
482:b02da778362e 483:f69d88f86b9c
671 property_value = wsxml_node2data(pool, prop->value.node); 671 property_value = wsxml_node2data(pool, prop->value.node);
672 } else if(prop->vtype == WS_VALUE_XML_DATA) { 672 } else if(prop->vtype == WS_VALUE_XML_DATA) {
673 property_value = &prop->value.data; 673 property_value = &prop->value.data;
674 } 674 }
675 675
676 cx_bprintf(&buf, "prop xmlns:%s=\"%s\" %s\n", prop->namespace->prefix, prop->namespace->href, prop->name); 676 int ret = cx_bprintf(&buf, "prop xmlns:%s=\"%s\" %s\n", prop->namespace->prefix, prop->namespace->href, prop->name);
677 if(ret <= 0) {
678 pool_free(pool, buf.space);
679 return (cxmutstr){NULL,0};
680 }
677 if(property_value) { 681 if(property_value) {
678 WebdavNSList *ns = property_value->namespaces; 682 WebdavNSList *ns = property_value->namespaces;
679 while(ns) { 683 while(ns) {
680 cx_bprintf(&buf, "ns %s:%s\n", prop->namespace->prefix, prop->namespace->href); 684 ret = cx_bprintf(&buf, "ns %s:%s\n", prop->namespace->prefix, prop->namespace->href);
685 if(ret <= 0) {
686 pool_free(pool, buf.space);
687 return (cxmutstr){NULL,0};
688 }
681 ns = ns->next; 689 ns = ns->next;
682 } 690 }
683 691
684 cx_bprintf(&buf, "data %zu\n", property_value->length); 692 ret = cx_bprintf(&buf, "data %zu\n", property_value->length);
693 if(ret <= 0) {
694 pool_free(pool, buf.space);
695 return (cxmutstr){NULL,0};
696 }
697
685 cxBufferWrite(property_value->data, 1, property_value->length, &buf); 698 cxBufferWrite(property_value->data, 1, property_value->length, &buf);
686 cxBufferPut(&buf, '\n'); 699 if(cxBufferPut(&buf, '\n') < 0) {
700 pool_free(pool, buf.space);
701 return (cxmutstr){NULL,0};
702 }
687 } 703 }
688 } 704 }
689 705
690 return (cxmutstr){buf.space, buf.size}; 706 return (cxmutstr){buf.space, buf.size};
691 } 707 }

mercurial