summaryrefslogtreecommitdiffstats
path: root/sys-utils/readprofile.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
commitc61e14d3a8412cd50d98aab604e607692c844c8a (patch)
tree4925aca0e6b64c8664ea2f3fdfa99a52dc93d5da /sys-utils/readprofile.c
parentAdding upstream version 2.39.3. (diff)
downloadutil-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.tar.xz
util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.zip
Adding upstream version 2.40.upstream/2.40
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sys-utils/readprofile.c')
-rw-r--r--sys-utils/readprofile.c31
1 files changed, 10 insertions, 21 deletions
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);
}