diff options
-rw-r--r-- | configure.ac | 45 | ||||
-rw-r--r-- | man/Makefile.am | 3 | ||||
-rw-r--r-- | src/collect/collect.c | 33 | ||||
-rw-r--r-- | src/udev/udev-node.c | 9 | ||||
-rw-r--r-- | src/udev/udevadm-settle.c | 5 | ||||
-rw-r--r-- | src/udev/udevd.c | 5 |
6 files changed, 75 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac index 85e297b8d4..a661165432 100644 --- a/configure.ac +++ b/configure.ac @@ -251,15 +251,46 @@ AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [ ]) # ------------------------------------------------------------------------------ -have_manpages=no -AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages])) -AS_IF([test "x$enable_manpages" != xno], [ - AS_IF([test "x$enable_manpages" = xyes -a "x$XSLTPROC" = x], [ - AC_MSG_ERROR([*** Manpages requested but xsltproc not found]) + +AC_ARG_VAR([XML_CATALOG_FILES],[Used to find Docbook catalog (to build man pages)]) +AC_ARG_ENABLE([manpages], AS_HELP_STRING([--disable-manpages], [disable manpages])) + +if test "x$enable_manpages" != "xno" -a "x$XSLTPROC" != "x"; then + AC_MSG_CHECKING([for local Docbook stylesheets]) + $XSLTPROC --nonet http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl >/dev/null 2>&1 << END +<?xml version="1.0" encoding='ISO-8859-1'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<book id="test"> +</book> +END + if test "$?" = 0; then + docbook_ok=yes + XSLTPROC_FLAGS=--nonet + AC_MSG_RESULT(${docbook_ok}) + else + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([for Docbook stylesheets via internet(use '--disable-manpages' flag to omit)]) + $XSLTPROC http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl >/dev/null 2>&1 << END +<?xml version="1.0" encoding='ISO-8859-1'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<book id="test"> +</book> +END + if test "$?" = 0; then + docbook_ok=yes + XSLTPROC_FLAGS= + else + docbook_ok=no + fi + AC_MSG_RESULT(${docbook_ok}) + fi + + AS_IF([test "x${docbook_ok}" = "xyes"],[have_manpages=yes], [ + AC_MSG_WARN([Manpages requested but docbook not enabled. Manpages disabled!]) ]) - AS_IF([test "x$XSLTPROC" != x], [have_manpages=yes]) -]) +fi AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"]) +AC_SUBST(XSLTPROC_FLAGS) # ------------------------------------------------------------------------------ diff --git a/man/Makefile.am b/man/Makefile.am index a82d537dbf..80d2086772 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -22,8 +22,7 @@ man_MANS = \ CLEANFILES = \ $(MANPAGES) -XSLTPROC_FLAGS = \ - --nonet \ +XSLTPROC_FLAGS += \ --stringparam man.output.quietly 1 \ --stringparam funcsynopsis.style ansi \ --stringparam man.th.extra1.suppress 1 \ diff --git a/src/collect/collect.c b/src/collect/collect.c index 7fefc62c10..b99a170420 100644 --- a/src/collect/collect.c +++ b/src/collect/collect.c @@ -83,6 +83,8 @@ static void usage(void) * prepare * * Prepares the database file + * returns file descriptor on success + * returns errno on failure */ static int prepare(char *dir, char *filename) { @@ -96,21 +98,22 @@ static int prepare(char *dir, char *filename) snprintf(buf, sizeof(buf), "%s/%s", dir, filename); fd = open(buf,O_RDWR|O_CREAT|O_CLOEXEC, S_IRUSR|S_IWUSR); - if (fd < 0) + if (fd < 0) { fprintf(stderr, "Cannot open %s: %m\n", buf); - + return errno; + } if (lockf(fd,F_TLOCK,0) < 0) { if (debug) - fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); - if (errno == EAGAIN || errno == EACCES) { - alarm(UDEV_ALARM_TIMEOUT); - lockf(fd, F_LOCK, 0); - if (debug) - fprintf(stderr, "Acquired lock on %s\n", buf); - } else { + fprintf(stderr, "Lock aquisition failed, retry in %d seconds\n" + , UDEV_ALARM_TIMEOUT); + alarm(UDEV_ALARM_TIMEOUT); + if(lockf(fd, F_LOCK, 0)<0){ if (debug) fprintf(stderr, "Could not get lock on %s: %m\n", buf); - } + return errno; + } + if (debug) + fprintf(stderr, "Acquired lock on %s\n", buf); } return fd; @@ -476,10 +479,16 @@ int main(int argc, char **argv) kickout(); lseek(fd, 0, SEEK_SET); - ftruncate(fd, 0); + if(ftruncate(fd, 0)!=0) { + ret = errno; + goto out; + } ret = missing(fd); - lockf(fd, F_ULOCK, 0); + if(lockf(fd, F_ULOCK, 0) !=0 ) { + ret = errno; + goto out; + } close(fd); out: if (debug) diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 200e24fb41..2dddc7b4b4 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -286,8 +286,13 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { log_debug("set permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid); - chmod(devnode, mode); - chown(devnode, uid, gid); + ; + if((chmod(devnode, mode) !=0 ) || (chown(devnode, uid,gid) !=0)) { + err = -errno; + log_error("FAILED to set permissions %s, %#o, uid=%u, gid=%u" + ,devnode, mode, uid, gid); + goto out; + } } else { log_debug("preserve permissions %s, %#o, uid=%u, gid=%u", devnode, mode, uid, gid); } diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c index 9eeeab8f14..9ae6c6bf8e 100644 --- a/src/udev/udevadm-settle.c +++ b/src/udev/udevadm-settle.c @@ -201,7 +201,10 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { char buf[sizeof(struct inotify_event) + PATH_MAX]; - read(pfd[0].fd, buf, sizeof(buf)); + if(read(pfd[0].fd, buf, sizeof(buf)) < 0){ + log_error("failed to read /run/udev"); + goto out; + } } } else { sleep(1); diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 850e4f5ef6..03de852c02 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -1031,7 +1031,10 @@ int main(int argc, char *argv[]) } /* set umask before creating any file/directory */ - chdir("/"); + if(chdir("/")!= 0) { + log_error("unable to change into directory '/'"); + goto exit; + } umask(022); mkdir("/run/udev", 0755); |