suggested bsd-setproctitle.c
Kevin Steves
stevesk at sweden.hp.com
Mon Nov 6 22:25:39 EST 2000
On Mon, 6 Nov 2000, Kevin Steves wrote:
: That should work. But it seems this __progname issue could be cleaned
: up by defining the variable in main() files if needed:
:
: #ifndef HAVE___PROGNAME
: const char *__progname = "foo";
: #endif
:
: then declaring it (no ifdefs) if it's referenced:
:
: extern const char *__progname;
:
: This gets us closer to OpenBSD's tree with fewer ifdefs.
:
: I'll do this patch unless someone points out what it will break :)
How does the attached patch look?
-------------- 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/06 11:02:51
@@ -56,11 +56,7 @@
#define MAX_PROCTITLE 2048
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else
-static const char *__progname = "sshd";
-#endif /* HAVE___PROGNAME */
+extern const char *__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/06 11:02:51
@@ -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/06 11:02:53
@@ -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 */
+extern const char *__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/06 11:02: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 const char *__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/06 11:02:56
@@ -48,11 +48,9 @@
#include "authfd.h"
#include "authfile.h"
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-add";
-#endif /* HAVE___PROGNAME */
+#ifndef HAVE___PROGNAME
+const 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/06 11:02:57
@@ -92,11 +92,9 @@
char socket_name[1024];
char socket_dir[1024];
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-agent";
-#endif /* HAVE___PROGNAME */
+#ifndef HAVE___PROGNAME
+const 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/06 11:02:57
@@ -70,11 +70,9 @@
int dsa_mode = 0;
/* argv0 */
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh-keygen";
-#endif /* HAVE___PROGNAME */
+#ifndef HAVE___PROGNAME
+const 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/06 11:03:01
@@ -59,11 +59,9 @@
#include "authfd.h"
#include "authfile.h"
-#ifdef HAVE___PROGNAME
-extern char *__progname;
-#else /* HAVE___PROGNAME */
-static const char *__progname = "ssh";
-#endif /* HAVE___PROGNAME */
+#ifndef HAVE___PROGNAME
+const 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/06 11:03:01
@@ -90,6 +90,10 @@
#define get_string(lenp) buffer_get_string(&iqueue, lenp);
#define TRACE log
+#ifndef HAVE___PROGNAME
+const char *__progname = "sftp-server";
+#endif
+
/* input and output queue */
Buffer iqueue;
Buffer oqueue;
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/06 11:03:09
@@ -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