[tac_plus] possible minor bug in code in waitfor() ...

john heasley heas at shrubbery.net
Wed Sep 8 20:24:32 UTC 2010


Wed, Sep 08, 2010 at 01:13:31PM -0700, john heasley:
Wed, Sep 08, 2010 at 02:18:55PM -0400, Kambiz Aghaiepour:
> I noticed waitfor() in programs.c calls the report() function, but seems
> to use the unsupported %l format string.  I wonder if those need to be
> %d instead ?  There is a line in packet.c and two other places in
> tac_plus.c where this happens as well.

it should be "%ld"

like so

Index: tac_plus.c
===================================================================
--- tac_plus.c	(revision 3285)
+++ tac_plus.c	(working copy)
@@ -143,7 +143,7 @@
 	if (pid <= 0)
 	    return;
 	if (debug & DEBUG_FORK_FLAG)
-	    report(LOG_DEBUG, "%l reaped", (long)pid);
+	    report(LOG_DEBUG, "%ld reaped", (long)pid);
     }
 }
 #endif /* REAPCHILD */
@@ -631,7 +631,7 @@
 		tac_exit(0);
 	} else {
 	    if (debug & DEBUG_FORK_FLAG)
-		report(LOG_DEBUG, "forked %l", (long)pid);
+		report(LOG_DEBUG, "forked %ld", (long)pid);
 	    /* parent */
 	    close(newsockfd);
 	}
Index: programs.c
===================================================================
--- programs.c	(revision 3285)
+++ programs.c	(working copy)
@@ -204,17 +204,17 @@
     ret = waitpid(pid, &status, 0);
 
     if (ret < 0) {
-	report(LOG_ERR, "%s: pid %l no child exists", session.peer, (long)pid);
+	report(LOG_ERR, "%s: pid %ld no child exists", session.peer, (long)pid);
 	return(-1);
     }
     if (!WIFEXITED(status)) {
-	report(LOG_ERR, "%s: pid %l child in illegal state", session.peer,
+	report(LOG_ERR, "%s: pid %ld child in illegal state", session.peer,
 	       (long)pid);
 	return(-1);
     }
     if (debug & DEBUG_AUTHOR_FLAG)
-	report(LOG_DEBUG, "pid %d child exited status %l", (long)pid,
-	       WEXITSTATUS(status));
+	report(LOG_DEBUG, "pid %ld child exited status %ld", (long)pid,
+	       (long)WEXITSTATUS(status));
 
     return(WEXITSTATUS(status));
 }



More information about the tac_plus mailing list