From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 14079139082 for ; Tue, 28 Nov 2017 10:49:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 46D5BE0E5E; Tue, 28 Nov 2017 10:48:59 +0000 (UTC) Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EED20E0E5E for ; Tue, 28 Nov 2017 10:48:58 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id k66so36425880lfg.3 for ; Tue, 28 Nov 2017 02:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=t03Vo7mBYZoNedzC9//gOZDY/ZlhsrLHk01boNjGIAQ=; b=DdoFm261OdtMPXXB8a34lDrOAqPkUQu6LCULU0rXMrDJTGZfQqTfrAlxaDRbS0Hx43 lkWXJuxebSF0D0EYkD96sKU74Bec1yoriQbl3E1LSPbdi5XothRqcXvxvKcxeRVYLig/ OWYMsy4vMOacKrm33KGRqPmJf7pMl3EtOG81TPOJSnFdaLVQQklWcJvCvkJMgkVY0inf sOA1C/O8oQklomHsR6fqbWshC4z6sZKEAWiMRLDaNp4JNLCyseQapaVc4h3ZZTUw4nIe s8UYU3F3Fwx91jwogK2V2kdxiPnZ4AG8ku7yNmMBlJdW42Xkvn3x0Q2pk9Uql2jB0qQr r9Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=t03Vo7mBYZoNedzC9//gOZDY/ZlhsrLHk01boNjGIAQ=; b=nSdgG3E81Ya9pfVivfl0n2zxpgrqSpYaO+RFO4Ub39Q7Vh8w+eP65dWVdWdx2ajJHB a8sVK172FRQffUzXJA4/jGOfILj7vA7ksKBP5Py/nYK6SCCcvp5S0pdICeavO7WT7Gwr PnrQMV59331QDgHqazZ4HFaqrZthrlhb17oCBy5FeqMNhbNtRSJKrBuLWjkIbzFkFu8L zOUgkL0JbpBSZhk0X4W29OEl2iqanzcDl1lJwLQl6NMYLBJtnW8VjkCsXMZ7y1aWws1b aVvwxst8sRtWjxf6yCjSnguZl/bu6IThzUxOXMP8mbbOGL1n97/e/BRb10g4gEocMEOG gFNw== X-Gm-Message-State: AJaThX5eP/YDgApt0ucK5Gh95QrmAYa7GT+/fPyMMMpfTGVmwFQmhZtL oxAdH8OJZlpEhuvhmwTjiauK8g== X-Google-Smtp-Source: AGs4zMYRzEWsJQpMWK/7dBtj9rE/RUjY2+cZuGiudGBEUAP+DTe6G8X3y65jawL/10ynnttjdj3O6A== X-Received: by 10.25.29.81 with SMTP id d78mr3850297lfd.3.1511866137418; Tue, 28 Nov 2017 02:48:57 -0800 (PST) Received: from localhost.localdomain (c-2ec2c16d-74736162.cust.telenor.se. [46.194.193.109]) by smtp.gmail.com with ESMTPSA id v63sm1760079lfg.14.2017.11.28.02.48.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 02:48:56 -0800 (PST) From: Marcus Folkesson To: eudev@lists.gentoo.org Cc: Marcus Folkesson Subject: [eudev] [PATCH] libudev-monitor.c: fail to monitor udev if udev is not started Date: Tue, 28 Nov 2017 11:48:51 +0100 Message-Id: <20171128104851.8527-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.15.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: eudev mailing list X-BeenThere: eudev@gentoo.org X-BeenThere: eudev@lists.gentoo.org X-Archives-Salt: 5e40ed55-72c2-4c89-8a9c-81287ec3b3ff X-Archives-Hash: 90be2fb89e8458fad302c57d2fe32065 We makes two controls if we consider udev is started; access(UDEV_ROOT_RUN "/udev/control", F_OK) < 0 and !udev_has_devtmpfs(udev)) If one(not both) of these statements fails, we consider that udev is not running. Signed-off-by: Marcus Folkesson --- src/libudev/libudev-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index fe494a4a7..614149c62 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -186,7 +186,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c * We do not set a netlink multicast group here, so the socket * will not receive any messages. */ - if (access(UDEV_ROOT_RUN "/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) { + if (access(UDEV_ROOT_RUN "/udev/control", F_OK) < 0 || !udev_has_devtmpfs(udev)) { log_debug("the udev service seems not to be active, disable the monitor"); group = UDEV_MONITOR_NONE; } else -- 2.13.1