mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
parthelper: fix compilation without optimization
Daniel's patch works with gcc and CFLAGS containing -O (the autoconf default), but fails with non-gcc or with other CFLAGS (such as -g), since c-ctype.h declares c_isdigit as a macro only for certain compilation settings. * src/Makefile.am (libvirt_parthelper_LDFLAGS): Add gnulib library, for when c_isdigit is not a macro. * src/storage/parthelper.c (main): Avoid out-of-bounds dereference, noticed by Jim Meyering.
This commit is contained in:
parent
bc8d9f2077
commit
352b6df34d
@ -1038,7 +1038,7 @@ libexec_PROGRAMS += libvirt_parthelper
|
|||||||
libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
|
libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
|
||||||
libvirt_parthelper_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
|
libvirt_parthelper_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
|
||||||
libvirt_parthelper_LDADD = $(LIBPARTED_LIBS)
|
libvirt_parthelper_LDADD = $(LIBPARTED_LIBS)
|
||||||
libvirt_parthelper_CFLAGS = $(LIBPARTED_CFLAGS)
|
libvirt_parthelper_CFLAGS = $(LIBPARTED_CFLAGS) ../gnulib/lib/libgnu.la
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
EXTRA_DIST += $(STORAGE_HELPER_DISK_SOURCES)
|
EXTRA_DIST += $(STORAGE_HELPER_DISK_SOURCES)
|
||||||
|
@ -69,7 +69,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
path = argv[1];
|
path = argv[1];
|
||||||
partsep = c_isdigit(path[strlen(path)-1]) ? "p" : "";
|
partsep = *path && c_isdigit(path[strlen(path)-1]) ? "p" : "";
|
||||||
|
|
||||||
if ((dev = ped_device_get(path)) == NULL) {
|
if ((dev = ped_device_get(path)) == NULL) {
|
||||||
fprintf(stderr, "unable to access device %s\n", path);
|
fprintf(stderr, "unable to access device %s\n", path);
|
||||||
|
Loading…
Reference in New Issue
Block a user