X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udevdb.c;h=fb34ca61d35cc337d2d5cf5b757fddd69c8898ed;hb=221204964609fec81f50a6c411f276c88f412755;hp=c2e90be32f47a71eceddc820c041e17c734ff4b6;hpb=dbfc520c605dee3244dbbfd563e908901324689b;p=elogind.git diff --git a/udevdb.c b/udevdb.c index c2e90be32..fb34ca61d 100644 --- a/udevdb.c +++ b/udevdb.c @@ -1,3 +1,26 @@ +/* + * udevdb.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * 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 #include +#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; }