]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/udevadm-settle.c
tree-wide: sort includes
[thirdparty/systemd.git] / src / udev / udevadm-settle.c
index 437c79408a675af5718e7d540e3e29f4d401e052..6a5dc6e9e442ea396b82bbfff7dbd31a1c6b01e9 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
 #include <errno.h>
 #include <getopt.h>
 #include <poll.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
+#include "parse-util.h"
 #include "udev.h"
 #include "util.h"
 
@@ -65,10 +66,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
 
                         r = safe_atou(optarg, &timeout);
                         if (r < 0) {
-                                fprintf(stderr, "Invalid timeout value '%s': %s\n",
-                                        optarg, strerror(-r));
-                                exit(EXIT_FAILURE);
-                        };
+                                log_error_errno(r, "Invalid timeout value '%s': %m", optarg);
+                                return EXIT_FAILURE;
+                        }
                         break;
                 }
 
@@ -107,7 +107,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
 
                 uctrl = udev_ctrl_new(udev);
                 if (uctrl != NULL) {
-                        if (udev_ctrl_send_ping(uctrl, timeout) < 0) {
+                        if (udev_ctrl_send_ping(uctrl, MAX(5U, timeout)) < 0) {
                                 log_debug("no connection to daemon");
                                 udev_ctrl_unref(uctrl);
                                 return EXIT_SUCCESS;