Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/resize resize.c: use estrdup(3) with basename(3)



details:   https://anonhg.NetBSD.org/src/rev/2c7900adf0a4
branches:  trunk
changeset: 374357:2c7900adf0a4
user:      gutteridge <gutteridge%NetBSD.org@localhost>
date:      Thu Apr 20 22:23:53 2023 +0000

description:
resize.c: use estrdup(3) with basename(3)

basename(3) is invoked more than once on different paths. Retain the
correct name for the utility itself on error. Addresses PR bin/57355
from RVP, who provided the patch.

diffstat:

 usr.bin/resize/resize.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 2efaabe76b3d -r 2c7900adf0a4 usr.bin/resize/resize.h
--- a/usr.bin/resize/resize.h   Thu Apr 20 10:43:17 2023 +0000
+++ b/usr.bin/resize/resize.h   Thu Apr 20 22:23:53 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: resize.h,v 1.2 2021/02/28 00:44:58 christos Exp $      */
+/*     $NetBSD: resize.h,v 1.3 2023/04/20 22:23:53 gutteridge Exp $    */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 #define TTYSIZE_COLS(ws) (ws).ws_col
 #define SET_TTYSIZE(fd, ws) ioctl((fd), TIOCSWINSZ, &(ws))
 
-#define x_basename(a) basename(a)
+#define x_basename(a) estrdup(basename(a))
 #define x_strdup(a) estrdup(a)
 #define x_getenv(a) getenv(a)
 #define x_getlogin(u, p) __nothing



Home | Main Index | Thread Index | Old Index