Zap _THIS_PORT helper for printf("%n") tracking in ports land
authorjca <jca@openbsd.org>
Wed, 8 Sep 2021 15:57:27 +0000 (15:57 +0000)
committerjca <jca@openbsd.org>
Wed, 8 Sep 2021 15:57:27 +0000 (15:57 +0000)
This hack isn't very useful now that libc aborts on printf("%n") calls,
it's expected that the resulting error would lead to a build
failure, and that the coredump along with the syslog message should be
enough to find the culprit.

Hinted by naddy@ and prodded by deraadt@

lib/libc/stdio/vfprintf.c
lib/libc/stdio/vfwprintf.c

index 527de41..9c684c8 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vfprintf.c,v 1.80 2021/08/30 11:16:49 deraadt Exp $   */
+/*     $OpenBSD: vfprintf.c,v 1.81 2021/09/08 15:57:27 jca Exp $       */
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
@@ -805,12 +805,6 @@ fp_common:
                        /* <10> is LOG_CRIT */
                        strlcpy(buf, "<10>", sizeof buf);
 
-                       /* XXX */
-                       if ((p = getenv("_THIS_PORT")) != NULL) {
-                               strlcat(buf, p, sizeof buf);
-                               strlcat(buf, " ", sizeof buf);
-                       }
-
                        /* Make sure progname does not fill the whole buffer */
                        strlcat(buf, __progname, sizeof(buf) - sizeof n_msg);
                        strlcat(buf, n_msg, sizeof buf);
index 15312c2..c6db189 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vfwprintf.c,v 1.21 2021/08/30 11:16:49 deraadt Exp $ */
+/*     $OpenBSD: vfwprintf.c,v 1.22 2021/09/08 15:57:27 jca Exp $ */
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
@@ -789,12 +789,6 @@ fp_common:
                        /* <10> is LOG_CRIT */
                        strlcpy(buf, "<10>", sizeof buf);
 
-                       /* XXX */
-                       if ((p = getenv("_THIS_PORT")) != NULL) {
-                               strlcat(buf, p, sizeof buf);
-                               strlcat(buf, " ", sizeof buf);
-                       }
-
                        /* Make sure progname does not fill the whole buffer */
                        strlcat(buf, __progname, sizeof(buf) - sizeof n_msg);
                        strlcat(buf, n_msg, sizeof buf);