X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=libudev%2Flibudev-monitor.c;h=96c153fbd7db27b443370272c2fd5dc2d56394e9;hb=3c4b1738a9d591d7ddce361ea184b76b253c4e87;hp=2c6c685c6b9aa8f25417849a1f2622c71d5d98e0;hpb=9cc94b15223d158ad618a9b05210a7eb8f748007;p=elogind.git diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 2c6c685c6..96c153fbd 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -139,13 +139,12 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } - util_set_fd_cloexec(udev_monitor->sock); dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); return udev_monitor; @@ -197,13 +196,12 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char if (udev_monitor == NULL) return NULL; - udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } - util_set_fd_cloexec(udev_monitor->sock); udev_monitor->snl.nl_family = AF_NETLINK; udev_monitor->snl.nl_groups = group; @@ -336,7 +334,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) /* * get the address the kernel has assigned us - * it is usually, but not neccessarily the pid + * it is usually, but not necessarily the pid */ addrlen = sizeof(struct sockaddr_nl); err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); @@ -628,12 +626,12 @@ retry: next = strchr(slink, ' '); while (next != NULL) { next[0] = '\0'; - udev_device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink, 0); slink = &next[1]; next = strchr(slink, ' '); } if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink, 0); } else if (strncmp(key, "DRIVER=", 7) == 0) { udev_device_set_driver(udev_device, &key[7]); } else if (strncmp(key, "ACTION=", 7) == 0) { @@ -747,7 +745,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, /* * Use custom address for target, or the default one. * - * If we send to a muticast group, we will get + * If we send to a multicast group, we will get * ECONNREFUSED, which is expected. */ if (destination != NULL) @@ -768,7 +766,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * udev_monitor_filter_add_match_subsystem_devtype: * @udev_monitor: the monitor * @subsystem: the subsystem value to match the incoming devices against - * @devtype: the devtype value to matvh the incoming devices against + * @devtype: the devtype value to match the incoming devices against * * The filter must be installed before the monitor is switched to listening mode. *