MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / stdin2xml

Function stdin2xml

lib/common/xml.c:613–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613xmlNode *
614stdin2xml(void)
615{
616 size_t data_length = 0;
617 size_t read_chars = 0;
618
619 char *xml_buffer = NULL;
620 xmlNode *xml_obj = NULL;
621
622 do {
623 xml_buffer = realloc(xml_buffer, XML_BUFFER_SIZE + data_length + 1);
624 read_chars = fread(xml_buffer + data_length, 1, XML_BUFFER_SIZE, stdin);
625 data_length += read_chars;
626 } while (read_chars > 0);
627
628 if(data_length == 0) {
629 crm_warn("No XML supplied on stdin");
630 free(xml_buffer);
631 return NULL;
632 }
633
634 xml_buffer[data_length] = '\0';
635
636 xml_obj = string2xml(xml_buffer);
637 free(xml_buffer);
638
639 crm_log_xml_trace(xml_obj, "Created fragment");
640 return xml_obj;
641}
642
643static char *
644decompress_file(const char *filename)

Callers 3

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

string2xmlFunction · 0.85

Tested by

no test coverage detected