Tidying and compiler-silencing
[exim.git] / src / src / exim_dbutil.c
index e04f9ae31db7400c11b379c6e9af6de27dc4a2a1..491a4531509964d75e209559e91c3782ad984471 100644 (file)
@@ -260,7 +260,7 @@ ensures that Exim has exclusive use of the database before it even tries to
 open it. If there is a database, there should be a lock file in existence. */
 
 snprintf(CS dirname, sizeof(dirname), "%s/db", spool_directory);
-snprintf(CS filename, sizeof(filename), "%s/%.200s.lockfile", dirname, name);
+snprintf(CS filename, sizeof(filename), "%.54s/%.200s.lockfile", dirname, name);
 
 dbblock->lockfd = Uopen(filename, flags, 0);
 if (dbblock->lockfd < 0)
@@ -296,10 +296,10 @@ if (rc < 0)
 /* At this point we have an opened and locked separate lock file, that is,
 exclusive access to the database, so we can go ahead and open it. */
 
-sprintf(CS filename, "%s/%s", dirname, name);
+snprintf(CS filename, sizeof(filename), "%s/%s", dirname, name);
 EXIM_DBOPEN(filename, dirname, flags, 0, &(dbblock->dbptr));
 
-if (dbblock->dbptr == NULL)
+if (!dbblock->dbptr)
   {
   printf("** Failed to open DBM file %s for %s:\n   %s%s\n", filename,
     read_only? "reading" : "writing", strerror(errno),