commit: 597c8e82be13b4081d0c27c38ed85b61bd3becf0
parent 3c95c5c93007f3c322d02b2ac86bf76f66eb0376
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 26 Dec 2024 08:42:57 +0100
cmd/*.c: simply reset errno after setlocale(3) instead of throwing a warning
Makes the test fails in environments where it partially failed to load.
And POSIX doesn't defines errors for setlocale(3) anyway.
Diffstat:
6 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/cmd/cut.c b/cmd/cut.c
@@ -366,13 +366,8 @@ main(int argc, char *argv[])
{
char *opt_list = NULL;
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
int c = -1;
while((c = getopt(argc, argv, ":b:c:d:f:ns")) != -1)
diff --git a/cmd/date.c b/cmd/date.c
@@ -57,13 +57,8 @@ main(int argc, char *argv[])
bool jflag = false;
bool settime = false;
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
tp.tv_sec = time(NULL);
if(tp.tv_sec == (time_t)-1)
diff --git a/cmd/mv.c b/cmd/mv.c
@@ -443,13 +443,8 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
consent_init();
diff --git a/cmd/paste.c b/cmd/paste.c
@@ -211,13 +211,8 @@ usage(void)
int
main(int argc, char *argv[])
{
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
int c = -1, seq = 0;
while((c = getopt(argc, argv, ":d:sz")) != -1)
diff --git a/cmd/rm.c b/cmd/rm.c
@@ -208,13 +208,8 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
consent_init();
diff --git a/cmd/wc.c b/cmd/wc.c
@@ -210,13 +210,8 @@ usage(void)
int
main(int argc, char *argv[])
{
- errno = 0;
setlocale(LC_ALL, "");
- if(errno != 0)
- {
- fprintf(stderr, "%s: warning: Failed to initialize locales: %s\n", argv0, strerror(errno));
- errno = 0;
- }
+ errno = 0;
int (*wc_file)(int, char *) = &wc_file_bytes;
int c = -1;