libblkid: remove dependence on libuuid

Currently we use libuuid to print UUID only. This code is possible to replace
by one snprintf(). It seems better to duplicate this one snprintf than force
all distros to keep libuuid together with libblkid.

Note, this scenario has been already supported on --disable-libuuid.

Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2019-01-22 12:33:19 +01:00
parent 33e87bf152
commit c2435b946f
4 changed files with 1 additions and 23 deletions

View File

@ -6,6 +6,5 @@ includedir=@includedir@
Name: blkid
Description: Block device id library
Version: @LIBBLKID_VERSION@
Requires.private: uuid
Cflags: -I${includedir}/blkid
Libs: -L${libdir} -lblkid

View File

@ -126,11 +126,6 @@ libblkid_la_CFLAGS = \
-I$(ul_libblkid_incdir) \
-I$(top_srcdir)/libblkid/src
if BUILD_LIBUUID
libblkid_la_LIBADD += libuuid.la
libblkid_la_CFLAGS += -I$(ul_libuuid_incdir)
endif
libblkid_la_LDFLAGS = $(SOLIB_LDFLAGS)
if HAVE_VSCRIPT
libblkid_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(top_srcdir)/libblkid/src/libblkid.sym
@ -157,12 +152,6 @@ check_PROGRAMS += \
blkid_tests_cflags = -DTEST_PROGRAM $(libblkid_la_CFLAGS)
blkid_tests_ldflags =
blkid_tests_ldadd = libblkid.la
if BUILD_LIBUUID
blkid_tests_ldflags += libuuid.la
blkid_tests_ldadd += $(LDADD)
endif
blkid_tests_ldflags += -static
test_blkid_cache_SOURCES = libblkid/src/cache.c

View File

@ -23,9 +23,7 @@
#include <stdarg.h>
#include <stdint.h>
#ifdef HAVE_LIBUUID
# include <uuid.h>
#else
#ifndef UUID_STR_LEN
# define UUID_STR_LEN 37
#endif

View File

@ -1886,13 +1886,6 @@ struct blkid_prval *__blkid_probe_lookup_value(blkid_probe pr, const char *name)
/* converts DCE UUID (uuid[16]) to human readable string
* - the @len should be always 37 */
#ifdef HAVE_LIBUUID
void blkid_unparse_uuid(const unsigned char *uuid, char *str,
size_t len __attribute__((__unused__)))
{
uuid_unparse(uuid, str);
}
#else
void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len)
{
snprintf(str, len,
@ -1903,7 +1896,6 @@ void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len)
uuid[8], uuid[9],
uuid[10], uuid[11], uuid[12], uuid[13], uuid[14],uuid[15]);
}
#endif
/* like uuid_is_null() from libuuid, but works with arbitrary size of UUID */
int blkid_uuid_is_empty(const unsigned char *buf, size_t len)