From 1272be04be0cb803eec87f602edb2e3e6f111aea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:34 +0200 Subject: Merging upstream version 2.40. Signed-off-by: Daniel Baumann --- sys-utils/readprofile.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'sys-utils/readprofile.c') diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 579902d..6e6a68b 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -1,21 +1,14 @@ /* - * readprofile.c - used to read /proc/profile + * SPDX-License-Identifier: GPL-2.0-or-later * - * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it) + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it) * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * readprofile.c - used to read /proc/profile */ /* @@ -88,14 +81,10 @@ static char *boot_uname_r_str(void) { struct utsname uname_info; char *s; - size_t len; if (uname(&uname_info)) return ""; - len = strlen(BOOT_SYSTEM_MAP) + strlen(uname_info.release) + 1; - s = xmalloc(len); - strcpy(s, BOOT_SYSTEM_MAP); - strcat(s, uname_info.release); + xasprintf(&s, "%s%s", BOOT_SYSTEM_MAP, uname_info.release); return s; } @@ -124,8 +113,8 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -r, --reset reset all the counters (root only)\n"), out); fputs(_(" -n, --no-auto disable byte order auto-detection\n"), out); fputs(USAGE_SEPARATOR, out); - printf(USAGE_HELP_OPTIONS(27)); - printf(USAGE_MAN_TAIL("readprofile(8)")); + fprintf(out, USAGE_HELP_OPTIONS(27)); + fprintf(out, USAGE_MAN_TAIL("readprofile(8)")); exit(EXIT_SUCCESS); } -- cgit v1.2.3