chiark / gitweb /
convert to libudev and delete udev_utils_string.c
[elogind.git] / udev / udevd.c
index a24ca925172518efb9c61e4fff06300026317981..06bfbd953e51de79c79acb655926b51122fd6ab9 100644 (file)
@@ -1,20 +1,19 @@
 /*
- * Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
  * Copyright (C) 2004 Chris Friesen <chris_friesen@sympatico.ca>
  *
- *     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.
+ * 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, either version 2 of the License, or
+ * (at your option) any later version.
  *
- *     This program is distributed in the hope that it will be useful, but
- *     WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *     General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public License along
- *     with this program; if not, write to the Free Software Foundation, Inc.,
- *     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -47,7 +46,6 @@
 
 #include "udev.h"
 #include "udev_rules.h"
-#include "udev_selinux.h"
 
 #define UDEVD_PRIORITY                 -4
 #define UDEV_PRIORITY                  -2
@@ -182,16 +180,16 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
        strlcat(filename_failed, "/", sizeof(filename_failed));
        start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed));
        strlcat(filename_failed, msg->devpath, sizeof(filename_failed));
-       path_encode(&filename_failed[start], sizeof(filename_failed) - start);
+       util_path_encode(&filename_failed[start], sizeof(filename_failed) - start);
 
        switch (state) {
        case EVENT_QUEUED:
                unlink(filename_failed);
                delete_path(msg->udev, filename_failed);
                create_path(msg->udev, filename);
-               selinux_setfscreatecon(msg->udev, filename, NULL, S_IFLNK);
+               udev_selinux_setfscreatecon(msg->udev, filename, S_IFLNK);
                symlink(msg->devpath, filename);
-               selinux_resetfscreatecon(msg->udev);
+               udev_selinux_resetfscreatecon(msg->udev);
                break;
        case EVENT_FINISHED:
                if (msg->devpath_old != NULL) {
@@ -202,7 +200,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
                        strlcat(filename_failed_old, "/", sizeof(filename_failed_old));
                        start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old));
                        strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old));
-                       path_encode(&filename_failed_old[start], sizeof(filename) - start);
+                       util_path_encode(&filename_failed_old[start], sizeof(filename) - start);
 
                        if (rename(filename_failed_old, filename_failed) == 0)
                                info(msg->udev, "renamed devpath, moved failed state of '%s' to %s'\n",
@@ -804,8 +802,6 @@ int main(int argc, char *argv[])
 
        logging_init("udevd");
        udev_set_log_fn(udev, log_fn);
-
-       selinux_init(udev);
        dbg(udev, "version %s\n", VERSION);
 
        while (1) {
@@ -1107,7 +1103,6 @@ int main(int argc, char *argv[])
 exit:
        udev_rules_cleanup(&rules);
        sysfs_cleanup();
-       selinux_exit(udev);
 
        if (signal_pipe[READ_END] >= 0)
                close(signal_pipe[READ_END]);