X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev.c;h=6e7ac25175b8dc9450b9426cda9a266f538c2288;hp=74572625afaae0830175bcf653e2063fc3d0b7b3;hb=dbfc520c605dee3244dbbfd563e908901324689b;hpb=149f210617e812922831e329c347095115585783 diff --git a/udev.c b/udev.c index 74572625a..6e7ac2517 100644 --- a/udev.c +++ b/udev.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -91,17 +92,27 @@ int main(int argc, char *argv[]) goto exit; } + /* initialize udev database */ + retval = udevdb_init(UDEVDB_DEFAULT); + if (retval != 0) { + dbg("Unable to initialize database."); + goto exit; + } + /* initialize the naming deamon */ namedev_init(); if (strcmp(action, "add") == 0) - return udev_add_device(device, argv[1]); + retval = udev_add_device(device, argv[1]); - if (strcmp(action, "remove") == 0) - return udev_remove_device(device, argv[1]); + else if (strcmp(action, "remove") == 0) + retval = udev_remove_device(device, argv[1]); - dbg("Unknown action: %s", action); - retval = -EINVAL; + else { + dbg("Unknown action: %s", action); + retval = -EINVAL; + } + udevdb_exit(); exit: return retval;