From e2df287aad883368584ccb2f460a47e9d3c41b42 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 21 Dec 2022 19:02:25 +0100 Subject: [PATCH] Don't redefine errno(3) It is Undefined Behavior to declare errno (see NOTES in its manual page). Instead of using the errno dummy declaration, use one that doesn't need a comment. Signed-off-by: Alejandro Colomar --- lib/gshadow.c | 2 +- lib/lockpw.c | 2 +- lib/nscd.c | 2 +- lib/pwauth.c | 2 +- lib/selinux.c | 2 +- lib/semanage.c | 2 +- lib/sgetspent.c | 2 +- lib/sgroupio.c | 2 +- lib/shadow.c | 2 +- lib/sssd.c | 2 +- lib/subordinateio.c | 2 +- lib/utent.c | 2 +- libmisc/addgrps.c | 2 +- libmisc/audit_help.c | 2 +- libmisc/find_new_sub_gids.c | 2 +- libmisc/find_new_sub_uids.c | 2 +- libmisc/limits.c | 2 +- libmisc/obscure.c | 2 +- libmisc/pam_pass.c | 2 +- libmisc/pam_pass_non_interactive.c | 2 +- libmisc/pwd2spwd.c | 2 +- libmisc/pwdcheck.c | 2 +- libmisc/tz.c | 2 +- src/login_nopam.c | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/gshadow.c b/lib/gshadow.c index 2e129230..cff8cb58 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -502,5 +502,5 @@ int putsgent (const struct sgrp *sgrp, FILE * fp) return 0; } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /*} SHADOWGRP */ diff --git a/lib/lockpw.c b/lib/lockpw.c index aaa317fd..15e7c8f4 100644 --- a/lib/lockpw.c +++ b/lib/lockpw.c @@ -81,5 +81,5 @@ int ulckpwdf (void) return (pw_unlock () && spw_unlock ())? 0 : -1; } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif diff --git a/lib/nscd.c b/lib/nscd.c index 2c2251af..451a5a36 100644 --- a/lib/nscd.c +++ b/lib/nscd.c @@ -53,6 +53,6 @@ int nscd_flush_cache (const char *service) return 0; } #else /* USE_NSCD */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* USE_NSCD */ diff --git a/lib/pwauth.c b/lib/pwauth.c index 62de4723..df67b04e 100644 --- a/lib/pwauth.c +++ b/lib/pwauth.c @@ -207,5 +207,5 @@ int pw_auth (const char *cipher, return retval; } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/lib/selinux.c b/lib/selinux.c index ad639bd3..5e3ef1a3 100644 --- a/lib/selinux.c +++ b/lib/selinux.c @@ -206,5 +206,5 @@ int check_selinux_permit (const char *perm_name) } #else /* !WITH_SELINUX */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !WITH_SELINUX */ diff --git a/lib/semanage.c b/lib/semanage.c index 082a6e8e..3f21b3ee 100644 --- a/lib/semanage.c +++ b/lib/semanage.c @@ -357,5 +357,5 @@ done: return ret; } #else /* !WITH_SELINUX */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !WITH_SELINUX */ diff --git a/lib/sgetspent.c b/lib/sgetspent.c index f1d4b201..0bdc21f1 100644 --- a/lib/sgetspent.c +++ b/lib/sgetspent.c @@ -182,6 +182,6 @@ struct spwd *sgetspent (const char *string) return (&spwd); } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif diff --git a/lib/sgroupio.c b/lib/sgroupio.c index 871749bd..aa95e116 100644 --- a/lib/sgroupio.c +++ b/lib/sgroupio.c @@ -302,5 +302,5 @@ int sgr_sort () return commonio_sort_wrt (&gshadow_db, __gr_get_db ()); } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif diff --git a/lib/shadow.c b/lib/shadow.c index b628b657..6a89a3f6 100644 --- a/lib/shadow.c +++ b/lib/shadow.c @@ -525,6 +525,6 @@ struct spwd *getspnam (const char *name) return (sp); } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif diff --git a/lib/sssd.c b/lib/sssd.c index 786ccd60..3727c8fd 100644 --- a/lib/sssd.c +++ b/lib/sssd.c @@ -70,6 +70,6 @@ int sssd_flush_cache (int dbflags) return 0; } #else /* USE_SSSD */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* USE_SSSD */ diff --git a/lib/subordinateio.c b/lib/subordinateio.c index bd1af26b..980cd245 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -1097,6 +1097,6 @@ bool release_subid_range(struct subordinate_range *range, enum subid_type id_typ } #else /* !ENABLE_SUBIDS */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !ENABLE_SUBIDS */ diff --git a/lib/utent.c b/lib/utent.c index d5e6daea..988201b2 100644 --- a/lib/utent.c +++ b/lib/utent.c @@ -66,5 +66,5 @@ struct utmp *getutent (void) return &utmp_buf; } #else -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif diff --git a/libmisc/addgrps.c b/libmisc/addgrps.c index 845d383b..63008a67 100644 --- a/libmisc/addgrps.c +++ b/libmisc/addgrps.c @@ -109,6 +109,6 @@ int add_groups (const char *list) return 0; } #else /* HAVE_SETGROUPS && !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* HAVE_SETGROUPS && !USE_PAM */ diff --git a/libmisc/audit_help.c b/libmisc/audit_help.c index e6c2006b..e9ce0551 100644 --- a/libmisc/audit_help.c +++ b/libmisc/audit_help.c @@ -82,6 +82,6 @@ void audit_logger_message (const char *message, shadow_audit_result result) } #else /* WITH_AUDIT */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* WITH_AUDIT */ diff --git a/libmisc/find_new_sub_gids.c b/libmisc/find_new_sub_gids.c index bbd4570b..74c9d8f5 100644 --- a/libmisc/find_new_sub_gids.c +++ b/libmisc/find_new_sub_gids.c @@ -59,6 +59,6 @@ int find_new_sub_gids (gid_t *range_start, unsigned long *range_count) return 0; } #else /* !ENABLE_SUBIDS */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !ENABLE_SUBIDS */ diff --git a/libmisc/find_new_sub_uids.c b/libmisc/find_new_sub_uids.c index a86b311a..cc4b0cf4 100644 --- a/libmisc/find_new_sub_uids.c +++ b/libmisc/find_new_sub_uids.c @@ -59,6 +59,6 @@ int find_new_sub_uids (uid_t *range_start, unsigned long *range_count) return 0; } #else /* !ENABLE_SUBIDS */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !ENABLE_SUBIDS */ diff --git a/libmisc/limits.c b/libmisc/limits.c index cf0e30ae..ea95a206 100644 --- a/libmisc/limits.c +++ b/libmisc/limits.c @@ -550,6 +550,6 @@ void setup_limits (const struct passwd *info) } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/libmisc/obscure.c b/libmisc/obscure.c index 3daaa958..f3b7096d 100644 --- a/libmisc/obscure.c +++ b/libmisc/obscure.c @@ -302,5 +302,5 @@ bool obscure (const char *old, const char *new, const struct passwd *pwdp) } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/libmisc/pam_pass.c b/libmisc/pam_pass.c index 166a42ef..ff491739 100644 --- a/libmisc/pam_pass.c +++ b/libmisc/pam_pass.c @@ -55,5 +55,5 @@ void do_pam_passwd (const char *user, bool silent, bool change_expired) (void) pam_end (pamh, PAM_SUCCESS); } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/libmisc/pam_pass_non_interactive.c b/libmisc/pam_pass_non_interactive.c index 34cdc1f2..eeaa3c80 100644 --- a/libmisc/pam_pass_non_interactive.c +++ b/libmisc/pam_pass_non_interactive.c @@ -141,5 +141,5 @@ int do_pam_passwd_non_interactive (const char *pam_service, return ((PAM_SUCCESS == ret) ? 0 : 1); } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/libmisc/pwd2spwd.c b/libmisc/pwd2spwd.c index 139a0240..636d81f2 100644 --- a/libmisc/pwd2spwd.c +++ b/libmisc/pwd2spwd.c @@ -62,6 +62,6 @@ struct spwd *pwd_to_spwd (const struct passwd *pw) return &sp; } #else /* USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/libmisc/pwdcheck.c b/libmisc/pwdcheck.c index 15fc3a33..e72920e8 100644 --- a/libmisc/pwdcheck.c +++ b/libmisc/pwdcheck.c @@ -34,5 +34,5 @@ void passwd_check (const char *user, const char *passwd, unused const char *prog } } #else /* USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* USE_PAM */ diff --git a/libmisc/tz.c b/libmisc/tz.c index 16d92ade..f3f5733e 100644 --- a/libmisc/tz.c +++ b/libmisc/tz.c @@ -52,6 +52,6 @@ return tzbuf; } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */ diff --git a/src/login_nopam.c b/src/login_nopam.c index 0ebe3bfc..c6a6b41e 100644 --- a/src/login_nopam.c +++ b/src/login_nopam.c @@ -335,5 +335,5 @@ static bool string_match (const char *tok, const char *string) } #else /* !USE_PAM */ -extern int errno; /* warning: ANSI C forbids an empty source file */ +extern int ISO_C_forbids_an_empty_translation_unit; #endif /* !USE_PAM */