suggested bsd-setproctitle.c

Kevin Steves stevesk at sweden.hp.com
Wed Nov 8 01:46:13 EST 2000


On Mon, 6 Nov 2000, Kevin Steves wrote:
: ok, in main() programs we need to have:
: 
: #ifndef HAVE___PROGNAME
: const char *__progname = "foo";
: #else
: extern char *__progname;
: #endif

How does the attached patch work?  I tested on HP-UX
!defined(HAVE___PROGNAME) and Linux defined(HAVE___PROGNAME).  I don't
use const now to keep things consistent, and went back to #ifdef
HAVE___PROGNAME.
-------------- next part --------------
Index: bsd-setproctitle.c
===================================================================
RCS file: /var/cvs/openssh/bsd-setproctitle.c,v
retrieving revision 1.1
diff -u -r1.1 bsd-setproctitle.c
--- bsd-setproctitle.c	2000/10/18 13:11:44	1.1
+++ bsd-setproctitle.c	2000/11/07 13:53:49
@@ -56,11 +56,7 @@
 
 #define	MAX_PROCTITLE	2048
 
-#ifdef HAVE___PROGNAME
 extern char *__progname;
-#else
-static const char *__progname = "sshd";
-#endif /* HAVE___PROGNAME */
 
 /*
  * Set Process Title (SPT) defines.  Modeled after sendmail's
Index: log-server.c
===================================================================
RCS file: /var/cvs/openssh/log-server.c,v
retrieving revision 1.12
diff -u -r1.12 log-server.c
--- log-server.c	2000/09/16 02:29:09	1.12
+++ log-server.c	2000/11/07 13:53:49
@@ -43,12 +43,6 @@
 #include "xmalloc.h"
 #include "ssh.h"
 
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "sshd";
-#endif /* HAVE___PROGNAME */
-
 static LogLevel log_level = SYSLOG_LEVEL_INFO;
 static int log_on_stderr = 0;
 static int log_facility = LOG_AUTH;
@@ -129,6 +123,7 @@
 	char fmtbuf[MSGBUFSIZ];
 	char *txt = NULL;
 	int pri = LOG_INFO;
+	extern char *__progname;
 
 	if (level > log_level)
 		return;
Index: sshconnect.c
===================================================================
RCS file: /var/cvs/openssh/sshconnect.c,v
retrieving revision 1.44
diff -u -r1.44 sshconnect.c
--- sshconnect.c	2000/09/23 06:15:57	1.44
+++ sshconnect.c	2000/11/07 13:53:52
@@ -35,11 +35,7 @@
 char *server_version_string = NULL;
 
 extern Options options;
-#ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh";
-#endif /* HAVE___PROGNAME */
 
 /*
  * Connect to the given ssh server using a proxy command.
Index: session.c
===================================================================
RCS file: /var/cvs/openssh/session.c,v
retrieving revision 1.52
diff -u -r1.52 session.c
--- session.c	2000/10/28 03:19:58	1.52
+++ session.c	2000/11/07 13:53:56
@@ -128,12 +128,7 @@
 
 /* import */
 extern ServerOptions options;
-#ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "sshd";
-#endif /* HAVE___PROGNAME */
-
 extern int log_stderr;
 extern int debug_flag;
 extern unsigned int utmp_len;
Index: ssh-add.c
===================================================================
RCS file: /var/cvs/openssh/ssh-add.c,v
retrieving revision 1.26
diff -u -r1.26 ssh-add.c
--- ssh-add.c	2000/10/17 12:22:28	1.26
+++ ssh-add.c	2000/11/07 13:53:56
@@ -50,9 +50,9 @@
 
 #ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-add";
-#endif /* HAVE___PROGNAME */
+#else
+char *__progname = "ssh-add";
+#endif
 
 void
 delete_file(AuthenticationConnection *ac, const char *filename)
Index: ssh-agent.c
===================================================================
RCS file: /var/cvs/openssh/ssh-agent.c,v
retrieving revision 1.33
diff -u -r1.33 ssh-agent.c
--- ssh-agent.c	2000/09/29 12:01:37	1.33
+++ ssh-agent.c	2000/11/07 13:53:58
@@ -94,9 +94,9 @@
 
 #ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-agent";
-#endif /* HAVE___PROGNAME */
+#else
+char *__progname = "ssh-agent";
+#endif
 
 void
 idtab_init(void)
Index: ssh-keygen.c
===================================================================
RCS file: /var/cvs/openssh/ssh-keygen.c,v
retrieving revision 1.26
diff -u -r1.26 ssh-keygen.c
--- ssh-keygen.c	2000/10/14 05:23:12	1.26
+++ ssh-keygen.c	2000/11/07 13:53:58
@@ -72,9 +72,9 @@
 /* argv0 */
 #ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-keygen";
-#endif /* HAVE___PROGNAME */
+#else
+char *__progname = "ssh-keygen";
+#endif
 
 char hostname[MAXHOSTNAMELEN];
 
Index: ssh.c
===================================================================
RCS file: /var/cvs/openssh/ssh.c,v
retrieving revision 1.47
diff -u -r1.47 ssh.c
--- ssh.c	2000/10/28 03:19:58	1.47
+++ ssh.c	2000/11/07 13:54:03
@@ -61,9 +61,9 @@
 
 #ifdef HAVE___PROGNAME
 extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh";
-#endif /* HAVE___PROGNAME */
+#else
+char *__progname = "ssh";
+#endif
 
 /* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
    Default value is AF_UNSPEC means both IPv4 and IPv6. */
Index: sftp-server.c
===================================================================
RCS file: /var/cvs/openssh/sftp-server.c,v
retrieving revision 1.3
diff -u -r1.3 sftp-server.c
--- sftp-server.c	2000/09/23 03:58:32	1.3
+++ sftp-server.c	2000/11/07 13:54:03
@@ -90,6 +90,12 @@
 #define get_string(lenp)		buffer_get_string(&iqueue, lenp);
 #define TRACE				log
 
+#ifdef HAVE___PROGNAME
+extern char *__progname;
+#else
+char *__progname = "sftp-server";
+#endif
+
 /* input and output queue */
 Buffer iqueue;
 Buffer oqueue;
Index: sshd.c
===================================================================
RCS file: /var/cvs/openssh/sshd.c,v
retrieving revision 1.94
diff -u -r1.94 sshd.c
--- sshd.c	2000/10/14 05:23:13	1.94
+++ sshd.c	2000/11/07 13:54:07
@@ -79,6 +79,12 @@
 #define O_NOCTTY	0
 #endif
 
+#ifdef HAVE___PROGNAME
+extern char *__progname;
+#else
+char *__progname = "sshd";
+#endif
+
 /* Server configuration options. */
 ServerOptions options;
 
Index: ChangeLog
===================================================================
RCS file: /var/cvs/openssh/ChangeLog,v
retrieving revision 1.519
diff -u -r1.519 ChangeLog
--- ChangeLog	2000/11/06 07:15:43	1.519
+++ ChangeLog	2000/11/07 13:54:17
@@ -11,6 +11,7 @@
  - (bal) typo in configure.in in regards to --with-ldflags from Marko
    Asplund <aspa at kronodoc.fi>
  - (bal) fixed next-posix.h.  Forgot prototype of getppid().
+ - (stevesk) Clean up __progname definitions.
 
 20001105
  - (bal) Sync with OpenBSD:


More information about the openssh-unix-dev mailing list