X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udevsend.c;h=29d5bc155e969976ff004b5afeb70d7ba5e8944e;hb=38ff77b80ba400ab059b6a215092bf25a3085b2e;hp=bdc69d0508e4c3ce786e895a65a6d66dd5e5980e;hpb=8ab44e3fd0b8fd4555db973d4c2c305ca09e787d;p=elogind.git diff --git a/udevsend.c b/udevsend.c index bdc69d050..29d5bc155 100644 --- a/udevsend.c +++ b/udevsend.c @@ -1,12 +1,9 @@ /* * udevsend.c * - * Userspace devfs - * * Copyright (C) 2004 Ling, Xiaofeng * Copyright (C) 2004 Kay Sievers * - * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2 of the License. @@ -22,17 +19,17 @@ * */ -#include -#include -#include -#include -#include -#include #include #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include "udev.h" @@ -92,27 +89,6 @@ static int start_daemon(void) return 0; } -static void run_udev(const char *subsystem) -{ - char *const argv[] = { "udev", (char *)subsystem, NULL }; - pid_t pid; - - pid = fork(); - switch (pid) { - case 0: - /* child */ - execv(UDEV_BIN, argv); - err("exec of udev child failed"); - _exit(1); - break; - case -1: - err("fork of udev child failed"); - break; - default: - waitpid(pid, NULL, 0); - } -} - int main(int argc, char *argv[], char *envp[]) { static struct udevd_msg usend_msg; @@ -135,7 +111,7 @@ int main(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { err("error getting socket"); - goto fallback; + goto exit; } memset(&saddr, 0x00, sizeof(struct sockaddr_un)); @@ -195,7 +171,7 @@ int main(int argc, char *argv[], char *envp[]) if (errno != ECONNREFUSED) { err("error sending message (%s)", strerror(errno)); - goto fallback; + goto exit; } if (!started_daemon) { @@ -203,7 +179,7 @@ int main(int argc, char *argv[], char *envp[]) retval = start_daemon(); if (retval) { dbg("error starting daemon"); - goto fallback; + goto exit; } dbg("udevd daemon started"); started_daemon = 1; @@ -213,10 +189,6 @@ int main(int argc, char *argv[], char *envp[]) } } -fallback: - err("unable to connect to event daemon, try to call udev directly"); - run_udev(subsystem); - exit: if (sock != -1) close(sock);