The volume_id/util.c file uses the strnlen function to check for the length of a string. As the strnlen(3) manual page says in a Linux system, this is a GNU extension, which means that the function is not available in operating systems that do not use the GNU libc. For example, NetBSD, but this surely affects many other. The build process emits a warning when building that file, saying that the prototype for strnlen is not available. This will result in a later failure during the link process because that call will not resolve to anything. The attached patch fixes this issue by getting rid of the strnlen call and replaces it with a very simple loop that does the same. I've preferred not to use a configure check nor other magic because it'd add unnecessary bloat with no real gain. The patch also fixes another warning that affects the isspace() call. As this is defined as a macro, the value passed to it is directly used by the code as an array subscript. This can be solved by using an explicit cast to int. See below for the output of the compiler: if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDEBUG -I/usr/pkg/include -I/usr/X11R6/include -g -O2 -Wall -Wchar-subscripts -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -MT util.lo -MD -MP -MF ".deps/util.Tpo" -c -o util.lo util.c; \ then mv -f ".deps/util.Tpo" ".deps/util.Plo"; else rm -f ".deps/util.Tpo"; exit 1; fi gcc -DHAVE_CONFIG_H -I. -I. -I.. -DDEBUG -I/usr/pkg/include -I/usr/X11R6/include -g -O2 -Wall -Wchar-subscripts -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -MT util.lo -MD -MP -MF .deps/util.Tpo -c util.c -fPIC -DPIC -o .libs/util.o util.c: In function `volume_id_set_label_string': util.c:114: warning: implicit declaration of function `strnlen' util.c:116: warning: subscript has type `char'
Created attachment 5172 [details] [review] Proposed patch.
volume_id will be removed from the hal sources sometimes soon and on Linux udev will provide the already queried data and also a shared lib to link against.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.