I've just been reorganising some machines and have a hostname that I don't
really want on the looking glass page, this diff uses the CGI variable
instead to take the hostname as given by the webserver instead, which is
easier to adjust how you want it.

OK to commit it, or should I keep it as a local diff?


Index: bgplg.c
===================================================================
RCS file: /cvs/src/usr.bin/bgplg/bgplg.c,v
retrieving revision 1.15
diff -u -p -r1.15 bgplg.c
--- bgplg.c     9 Dec 2015 17:52:24 -0000       1.15
+++ bgplg.c     5 Apr 2016 21:36:38 -0000
@@ -245,9 +245,8 @@ lg_incl(const char *file)
 int
 main(void)
 {
-       char *query, *self, *cmd = NULL, *req;
+       char *query, *myname, *self, *cmd = NULL, *req;
        char **argv = NULL;
-       char myname[HOST_NAME_MAX+1];
        int ret = 1, argc = 0, query_length = 0;
        struct stat st;
        u_int i;
@@ -256,7 +255,7 @@ main(void)
        if (pledge("stdio rpath proc exec", NULL) == -1)
                err(1, "pledge");
 
-       if (gethostname(myname, sizeof(myname)) != 0)
+       if ((myname = lg_getenv("SERVER_NAME", NULL)) == NULL)
                return (1);
 
        printf("Content-Type: %s\n"

Reply via email to