Better handling of printing NULL pointers
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 6 Oct 2017 17:11:22 +0000 (18:11 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Fri, 6 Oct 2017 17:11:22 +0000 (18:11 +0100)
src/src/string.c
test/stderr/0388
test/stderr/0398
test/stderr/0432
test/stderr/5005

index 3857e11..f3bf343 100644 (file)
@@ -1366,13 +1366,13 @@ while (*fp != 0)
       {
       void * ptr;
       if (p >= last - 24) { yield = FALSE; goto END_FORMAT; }
-      /* sprintf() saying "(nil)" for a null pointer doesn't work
-      on FreeBSD; we get "0xAAAAAAAA".  Handle it explicitly. */
+      /* sprintf() saying "(nil)" for a null pointer seems unreliable.
+      Handle it explicitly. */
       if ((ptr = va_arg(ap, void *)))
        {
        strncpy(newformat, item_start, fp - item_start);
        newformat[fp - item_start] = 0;
-       p += sprintf(CS p, newformat, va_arg(ap, void *));
+       p += sprintf(CS p, newformat, ptr);
        }
       else
        p += sprintf(CS p, "(nil)");
index f758b0a..5a21445 100644 (file)
@@ -141,7 +141,7 @@ Deferred addresses:
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDWR
 address match test: subject=x@y pattern=*
 y in "*"? yes (matched "*")
@@ -241,7 +241,7 @@ set_process_info: pppp delivering 10HmaY-0005vi-00
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x0
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDONLY
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 Considering: CALLER@myhost.test.ex
@@ -252,7 +252,7 @@ dbfn_read: key=R:CALLER@myhost.test.ex:<>
 no domain retry record
 no address retry record
 CALLER@myhost.test.ex: queued for routing
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 routing CALLER@myhost.test.ex
index 4a92dc6..f61f374 100644 (file)
@@ -121,13 +121,13 @@ Attempting full verification using callout
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR
 dbfn_read: key=remote
 callout cache: found domain record for remote
 dbfn_read: key=qq@remote
 callout cache: no address record found for qq@remote
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 interface=NULL port=1224
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
@@ -152,14 +152,14 @@ cmd buf flush ddd bytes
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x42
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR|O_CREAT
 dbfn_write: key=remote
 wrote callout cache domain record for remote:
   result=1 postmaster=0 random=0
 dbfn_write: key=qq@remote
 wrote negative callout cache address record for qq@remote
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 ----------- end verify ------------
 l_message: $acl_verify_message
@@ -234,14 +234,14 @@ Attempting full verification using callout
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR
 dbfn_read: key=remote
 callout cache: found domain record for remote
 dbfn_read: key=qq@remote
 callout cache: found address record for qq@remote
 callout cache: address record is negative
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 ----------- end verify ------------
 l_message: $acl_verify_message
index 69d929b..79117e2 100644 (file)
@@ -82,13 +82,13 @@ Attempting full verification using callout
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR
 dbfn_read: key=y
 callout cache: no domain record found for y
 dbfn_read: key=x@y
 callout cache: no address record found for x@y
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 interface=NULL port=1224
 Connecting to 127.0.0.1 [127.0.0.1]:1224 ... connected
@@ -113,14 +113,14 @@ cmd buf flush ddd bytes
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x42
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR|O_CREAT
 dbfn_write: key=y
 wrote callout cache domain record for y:
   result=1 postmaster=0 random=0
 dbfn_write: key=x@y
 wrote positive callout cache address record for x@y
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 ----------- end verify ------------
 sender x@y verified ok
@@ -192,14 +192,14 @@ Attempting full verification using callout
 locking TESTSUITE/spool/db/callout.lockfile
 locked  TESTSUITE/spool/db/callout.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/callout> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/callout: flags=O_RDWR
 dbfn_read: key=y
 callout cache: found domain record for y
 dbfn_read: key=x@y
 callout cache: found address record for x@y
 callout cache: address record is positive
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 ----------- end verify ------------
 sender x@y verified ok
index af664ae..7e6ea98 100644 (file)
@@ -554,7 +554,7 @@ Deferred addresses:
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDWR
 address match test: subject=userx@test.ex pattern=*
 test.ex in "*"? yes (matched "*")
@@ -566,7 +566,7 @@ Writing retry data for T:userx@test.ex
   first failed=dddd last try=dddd next try=+86400 expired=0
   errno=-22 more_errno=dd mailbox is full (MTA-imposed quota exceeded while writing to tmp/MAILDIR.myhost.test.ex)
 dbfn_write: key=T:userx@test.ex
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 end of retry processing
 delivery deferred: update_spool=1 header_rewritten=0
@@ -659,7 +659,7 @@ Delivery address list:
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x0
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDONLY
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 Considering: userx@test.ex
@@ -670,7 +670,7 @@ dbfn_read: key=R:userx@test.ex:<CALLER@test.ex>
 no domain retry record
 no address retry record
 userx@test.ex: queued for routing
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 routing userx@test.ex
@@ -700,12 +700,12 @@ search_tidyup called
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x0
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDONLY
 dbfn_read: key=T:userx@test.ex
 retry record exists: age=ttt (max 1w)
   time to retry = tttt expired = 0
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 search_tidyup called
 changed uid/gid: local delivery to userx <userx@test.ex> transport=t1
@@ -750,7 +750,7 @@ Deferred addresses:
 locking TESTSUITE/spool/db/retry.lockfile
 locked  TESTSUITE/spool/db/retry.lockfile
 EXIM_DBOPEN: file <TESTSUITE/spool/db/retry> dir <TESTSUITE/spool/db> flags 0x2
-returned from EXIM_DBOPEN: (nil)
+returned from EXIM_DBOPEN: 0xAAAAAAAA
 opened hints database TESTSUITE/spool/db/retry: flags=O_RDWR
 address match test: subject=userx@test.ex pattern=*
 test.ex in "*"? yes (matched "*")
@@ -762,7 +762,7 @@ Writing retry data for T:userx@test.ex
   first failed=dddd last try=dddd next try=+86400 expired=0
   errno=-22 more_errno=dd mailbox is full (MTA-imposed quota exceeded while writing to tmp/MAILDIR.myhost.test.ex)
 dbfn_write: key=T:userx@test.ex
-EXIM_DBCLOSE((nil))
+EXIM_DBCLOSE(0xAAAAAAAA)
 closed hints database and lockfile
 end of retry processing
 delivery deferred: update_spool=1 header_rewritten=0