getservice: getservent_r must return ERANGE when buffer is too small
getservice: getservent_r must return ERANGE when buffer is too small

This fixes issue introduced by 72e1a1ce186c39f07282398e2af9eb0253e60f15

This should also fix the following testcase to exit with error rather
than cause an endless loop.

int main(void) {
	if (getservbyname("non-existing", "udp") == NULL)
		err(1, "getservbyname");
	return 0;
}

Reported by Pirmin Walthert
http://lists.uclibc.org/pipermail/uclibc/2010-August/044277.html

Signed-off-by: Natanael Copa <e73df79305d2c30c2a35966f4bca3b7b6f223156@gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <ce1ac9e9ad16abccd7821f371ad381197b4768ac@gmail.com>

czankel/xtensa-uclibc,waweber/uclibc-clang,atgreen/uClibc-moxie,ysat0/uClibc,atgreen/uClibc-moxie,groundwater/uClibc,majek/uclibc-vx32,m-labs/uclibc-lm32,waweber/uclibc-clang,brgl/uclibc-ng,ffainelli/uClibc,groundwater/uClibc,m-labs/uclibc-lm32,czankel/xtensa-uclibc,wbx-github/uclibc-ng,ddcc/klee-uclibc-0.9.33.2,kraj/uclibc-ng,czankel/xtensa-uclibc,foss-for-synopsys-dwc-arc-processors/uClibc,groundwater/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,ffainelli/uClibc,foss-for-synopsys-dwc-arc-processors/uClibc,majek/uclibc-vx32,skristiansson/uClibc-or1k,ndmsystems/uClibc,hwoarang/uClibc,kraj/uclibc-ng,wbx-github/uclibc-ng,kraj/uclibc-ng,brgl/uclibc-ng,czankel/xtensa-uclibc,ysat0/uClibc,brgl/uclibc-ng,brgl/uclibc-ng,foss-xtensa/uClibc,ddcc/klee-uclibc-0.9.33.2,majek/uclibc-vx32,ndmsystems/uClibc,groundwater/uClibc,foss-xtensa/uClibc,hwoarang/uClibc,kraj/uClibc,ddcc/klee-uclibc-0.9.33.2,m-labs/uclibc-lm32,skristiansson/uClibc-or1k,wbx-github/uclibc-ng,waweber/uclibc-clang,mephi42/uClibc,ysat0/uClibc,hjl-tools/uClibc,wbx-github/uclibc-ng,m-labs/uclibc-lm32,hjl-tools/uClibc,hjl-tools/uClibc,skristiansson/uClibc-or1k,majek/uclibc-vx32,ddcc/klee-uclibc-0.9.33.2,hwoarang/uClibc,mephi42/uClibc,waweber/uclibc-clang,hjl-tools/uClibc,kraj/uClibc,mephi42/uClibc,hjl-tools/uClibc,ysat0/uClibc,ffainelli/uClibc,ndmsystems/uClibc,ffainelli/uClibc,atgreen/uClibc-moxie,foss-for-synopsys-dwc-arc-processors/uClibc,hwoarang/uClibc,kraj/uClibc,kraj/uClibc,foss-xtensa/uClibc,groundwater/uClibc,foss-xtensa/uClibc,mephi42/uClibc,ndmsystems/uClibc,ffainelli/uClibc,skristiansson/uClibc-or1k,kraj/uclibc-ng,atgreen/uClibc-moxie