add confSORT_QUEUE_BY_HOST and confBROKEN_SMTP_PEERS
[unix-history] / usr / src / usr.sbin / dev_mkdb / dev_mkdb.c
index 7617155..efb745b 100644 (file)
@@ -1,18 +1,18 @@
 /*-
 /*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
  *
  * %sccs.include.redist.c%
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1990, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)dev_mkdb.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)dev_mkdb.c 8.1 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -71,20 +71,23 @@ main(argc, argv)
 
        (void)snprintf(dbtmp, sizeof(dbtmp), "%sdev.tmp", _PATH_VARRUN);
        (void)snprintf(dbname, sizeof(dbtmp), "%sdev.db", _PATH_VARRUN);
 
        (void)snprintf(dbtmp, sizeof(dbtmp), "%sdev.tmp", _PATH_VARRUN);
        (void)snprintf(dbname, sizeof(dbtmp), "%sdev.db", _PATH_VARRUN);
-       db = dbopen(dbtmp, O_CREAT|O_EXLOCK|O_TRUNC|O_WRONLY,
+       db = dbopen(dbtmp, O_CREAT|O_EXLOCK|O_RDWR|O_TRUNC,
            S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, DB_HASH, NULL);
        if (db == NULL)
                err("%s: %s", dbtmp, strerror(errno));
 
        /*
         * Keys are a mode_t followed by a dev_t.  The former is the type of
            S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, DB_HASH, NULL);
        if (db == NULL)
                err("%s: %s", dbtmp, strerror(errno));
 
        /*
         * Keys are a mode_t followed by a dev_t.  The former is the type of
-        * the file (mode & S_IFMT), the latter is the st_rdev field.
+        * the file (mode & S_IFMT), the latter is the st_rdev field.  Note
+        * that the structure may contain padding, so we have to clear it
+        * out here.
         */
         */
+       bzero(&bkey, sizeof(bkey));
        key.data = &bkey;
        key.size = sizeof(bkey);
        data.data = buf;
        while (dp = readdir(dirp)) {
        key.data = &bkey;
        key.size = sizeof(bkey);
        data.data = buf;
        while (dp = readdir(dirp)) {
-               if (stat(dp->d_name, &sb)) {
+               if (lstat(dp->d_name, &sb)) {
                        (void)fprintf(stderr,
                            "dev_mkdb: %s: %s\n", dp->d_name, strerror(errno));
                        continue;
                        (void)fprintf(stderr,
                            "dev_mkdb: %s: %s\n", dp->d_name, strerror(errno));
                        continue;