chiark / gitweb /
[PATCH] update the spec file for the new version and install process.
[elogind.git] / udevdb.c
index c2e90be32f47a71eceddc820c041e17c734ff4b6..fb34ca61d35cc337d2d5cf5b757fddd69c8898ed 100644 (file)
--- a/udevdb.c
+++ b/udevdb.c
@@ -1,3 +1,26 @@
+/*
+ * udevdb.c
+ *
+ * Userspace devfs
+ *
+ * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+ * Copyright (C) 2003 IBM Corp.
+ *
+ *     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 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.,
+ *     675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
 /*
  * udev database library
  */
@@ -9,6 +32,9 @@
 #include <errno.h>
 #include <signal.h>
 
+#include "udev_version.h"
+#include "udev.h"
+#include "namedev.h"
 #include "udevdb.h"
 #include "tdb/tdb.h"
 
@@ -63,9 +89,14 @@ static void udevdb_close(void)
  */
 static int udevdb_open(int method)
 {
-       udevdb = tdb_open(UDEVDB, 0, method, O_RDWR | O_CREAT, 0644);
-       if (udevdb == NULL)
-               return -1;
+       udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, method, O_RDWR | O_CREAT, 0644);
+       if (udevdb == NULL) {
+               if (method == UDEVDB_INTERNAL)
+                       dbg("Unable to initialize in-memory database");
+               else
+                       dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB);
+               return -EINVAL;
+       }
        return 0;
 }