Intercept chown()/fchown() failure and emit a pointer to the bugreport. Closes 2391
[exim.git] / src / src / dbfn.c
index ec87eaeebe31f2624dfda0f1c6ed62fbcfbecaa1..5555c710b86fbb5e1b0e2cfa23547f495df93f1f 100644 (file)
@@ -137,9 +137,9 @@ DEBUG(D_hints_lookup|D_retry|D_route|D_deliver)
   debug_printf_indent("locking %s\n", filename);
 
 sigalrm_seen = FALSE;
-alarm(EXIMDB_LOCK_TIMEOUT);
+ALARM(EXIMDB_LOCK_TIMEOUT);
 rc = fcntl(dbblock->lockfd, F_SETLKW, &lock_data);
-alarm(0);
+ALARM_CLR(0);
 
 if (sigalrm_seen) errno = ETIMEDOUT;
 if (rc < 0)
@@ -209,7 +209,7 @@ if (created && geteuid() == root_uid)
       if (Ustat(filename, &statbuf) >= 0 && statbuf.st_uid != exim_uid)
         {
         DEBUG(D_hints_lookup) debug_printf_indent("ensuring %s is owned by exim\n", filename);
-        if (Uchown(filename, exim_uid, exim_gid))
+        if (exim_chown(filename, exim_uid, exim_gid))
           DEBUG(D_hints_lookup) debug_printf_indent("failed setting %s to owned by exim\n", filename);
         }
       }
@@ -382,6 +382,8 @@ dbfn_delete(open_db *dbblock, const uschar *key)
 int klen = Ustrlen(key) + 1;
 uschar * key_copy = store_get(klen);
 
+DEBUG(D_hints_lookup) debug_printf_indent("dbfn_delete: key=%s\n", key);
+
 memcpy(key_copy, key, klen);
 EXIM_DATUM key_datum;
 EXIM_DATUM_INIT(key_datum);         /* Some DBM libraries require clearing */
@@ -415,6 +417,8 @@ EXIM_DATUM key_datum, value_datum;
 uschar *yield;
 value_datum = value_datum;    /* dummy; not all db libraries use this */
 
+DEBUG(D_hints_lookup) debug_printf_indent("dbfn_scan\n");
+
 /* Some dbm require an initialization */
 
 if (start) EXIM_DBCREATE_CURSOR(dbblock->dbptr, cursor);