diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2012-11-23 18:56:16 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-11-23 18:56:16 -0500 |
commit | 6cb86c3a330caedc323599cb11fbed4138958271 (patch) | |
tree | 6b0f1e44d69ed1d043b23f5f64e9f7e8b9830c07 /src/libudev | |
parent | e5cc2b881fd1db175b0d80bcccf21ae70857a532 (diff) |
Propagation of configured installation paths to Makefile.am and .c code
This commit is a continuation of the previous one in which all the configured
paths obtained in configure.ac are propagated to the Makefile.am and .c files
via AM_CPPFLAGS of the form -DUDEV_CONF_FILE=\"$(udevconffile)\". This should
address the issue in
https://github.com/gentoo/eudev/issues/17
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/Makefile.am | 2 | ||||
-rw-r--r-- | src/libudev/libudev-hwdb.c | 10 | ||||
-rw-r--r-- | src/libudev/libudev.c | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/libudev/Makefile.am b/src/libudev/Makefile.am index 36647d13ed..9ccc3fe9ab 100644 --- a/src/libudev/Makefile.am +++ b/src/libudev/Makefile.am @@ -5,6 +5,8 @@ LIBUDEV_REVISION=0 LIBUDEV_AGE=2 AM_CPPFLAGS = \ + -DUDEV_CONF_FILE=\"$(udevconffile)\" \ + -DUDEV_HWDB_BIN=\"$(udevhwdbbin)\" \ -I $(top_srcdir)/src/udev lib_LTLIBRARIES = \ diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index 751b34209e..7521942eff 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -271,30 +271,30 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) { hwdb->refcount = 1; udev_list_init(udev, &hwdb->properties_list, true); - hwdb->f = fopen("/etc/udev/hwdb.bin", "re"); + hwdb->f = fopen(UDEV_HWDB_BIN, "re"); if (!hwdb->f) { - log_debug("error reading /etc/udev/hwdb.bin: %m"); + log_debug("error reading " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } if (fstat(fileno(hwdb->f), &hwdb->st) < 0 || (size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) { - log_debug("error reading /etc/udev/hwdb.bin: %m"); + log_debug("error reading " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0); if (hwdb->map == MAP_FAILED) { - log_debug("error mapping /etc/udev/hwdb.bin: %m"); + log_debug("error mapping " UDEV_HWDB_BIN ": %m"); udev_hwdb_unref(hwdb); return NULL; } if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 || (size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) { - log_debug("error recognizing the format of /etc/udev/hwdb.bin"); + log_debug("error recognizing the format of " UDEV_HWDB_BIN); udev_hwdb_unref(hwdb); return NULL; } diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c index 3341ee8ada..09c41e43a9 100644 --- a/src/libudev/libudev.c +++ b/src/libudev/libudev.c @@ -127,7 +127,7 @@ _public_ struct udev *udev_new(void) udev->log_priority = LOG_ERR; udev_list_init(udev, &udev->properties_list, true); - f = fopen("/etc/udev/udev.conf", "re"); + f = fopen( UDEV_CONF_FILE, "re"); if (f != NULL) { char line[UTIL_LINE_SIZE]; int line_nr = 0; @@ -151,7 +151,7 @@ _public_ struct udev *udev_new(void) /* split key/value */ val = strchr(key, '='); if (val == NULL) { - udev_err(udev, "missing <key>=<value> in /etc/udev/udev.conf[%i]; skip line\n", line_nr); + udev_err(udev, "missing <key>=<value> in " UDEV_CONF_FILE "[%i]; skip line\n", line_nr); continue; } val[0] = '\0'; @@ -183,7 +183,7 @@ _public_ struct udev *udev_new(void) /* unquote */ if (val[0] == '"' || val[0] == '\'') { if (val[len-1] != val[0]) { - udev_err(udev, "inconsistent quoting in /etc/udev/udev.conf[%i]; skip line\n", line_nr); + udev_err(udev, "inconsistent quoting in " UDEV_CONF_FILE"[%i]; skip line\n", line_nr); continue; } val[len-1] = '\0'; |