#include "shadow/grp/agetgroups.h"
#include "shadowlog.h"
#include "string/strchr/strchrscnt.h"
+#include "string/strerrno.h"
/*
free(dup);
if (setgroups(n, gids) == -1) {
- fprintf(shadow_logfd, "setgroups: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "setgroups: %s\n", strerrno());
goto free_gids;
}
#include "string/sprintf/snprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
if (log) {
(void) fprintf (shadow_logfd,
"%s: %s file stat error: %s\n",
- shadow_progname, file, strerror (errno));
+ shadow_progname, file, strerrno());
}
return 0;
}
if (log) {
(void) fprintf (shadow_logfd,
"%s: %s: %s\n",
- shadow_progname, file, strerror (errno));
+ shadow_progname, file, strerrno());
}
return 0;
}
if (log) {
(void) fprintf (shadow_logfd,
"%s: %s file write error: %s\n",
- shadow_progname, file, strerror (errno));
+ shadow_progname, file, strerrno());
}
(void) close (fd);
unlink (file);
if (log) {
(void) fprintf (shadow_logfd,
"%s: %s file sync error: %s\n",
- shadow_progname, file, strerror (errno));
+ shadow_progname, file, strerrno());
}
(void) close (fd);
unlink (file);
if (log) {
(void) fprintf (shadow_logfd,
"%s: %s: %s\n",
- shadow_progname, lock, strerror (errno));
+ shadow_progname, lock, strerrno());
}
unlink (file);
errno = EINVAL;
if (log) {
(void) fprintf (shadow_logfd,
"%s: cannot get lock %s: %s\n",
- shadow_progname, lock, strerror (errno));
+ shadow_progname, lock, strerrno());
}
unlink (file);
return 0;
if (log) {
(void) fprintf (shadow_logfd,
"%s: cannot get lock %s: %s\n",
- shadow_progname, lock, strerror (errno));
+ shadow_progname, lock, strerrno());
}
}
#include "string/sprintf/aprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
static /*@null@*/const char *src_orig;
if (vfprintf (shadow_logfd, fmt, ap) != 0) {
(void) fputs (_(": "), shadow_logfd);
}
- (void) fprintf (shadow_logfd, "%s\n", strerror (errno));
+ (void) fprintf(shadow_logfd, "%s\n", strerrno());
va_end (ap);
}
#include "config.h"
-#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "shadowlog.h"
+#include "string/strerrno.h"
/*
exit_if_null_(void *p)
{
if (p == NULL) {
- fprintf(log_get_logfd(), "%s: %s\n",
- log_get_progname(), strerror(errno));
+ fprintf(log_get_logfd(), "%s: %s\n", log_get_progname(), strerrno());
exit(13);
}
}
#include "groupio.h"
#include "getdef.h"
#include "shadowlog.h"
+#include "string/strerrno.h"
+
/*
* get_ranges - Get the minimum and maximum ID ranges for the search
if (NULL == used_gids) {
fprintf (log_get_logfd(),
_("%s: failed to allocate memory: %s\n"),
- log_get_progname(), strerror (errno));
+ log_get_progname(), strerrno());
return -1;
}
#include "pwio.h"
#include "getdef.h"
#include "shadowlog.h"
+#include "string/strerrno.h"
/*
* get_ranges - Get the minimum and maximum ID ranges for the search
if (NULL == used_uids) {
fprintf (log_get_logfd(),
_("%s: failed to allocate memory: %s\n"),
- log_get_progname(), strerror (errno));
+ log_get_progname(), strerrno());
return -1;
}
#include "defines.h"
#include "prototypes.h"
#include "string/sprintf/snprintf.h"
+#include "string/strerrno.h"
/*
if (SNPRINTF(proc_dir_name, "/proc/%d/", target) == -1) {
fprintf(stderr, "snprintf of proc path failed for %d: %s\n",
- target, strerror(errno));
+ target, strerrno());
return -EINVAL;
}
proc_dir_fd = open(proc_dir_name, O_DIRECTORY);
if (proc_dir_fd < 0) {
fprintf(stderr, _("Could not open proc directory for target %d: %s\n"),
- target, strerror(errno));
+ target, strerrno());
return -EINVAL;
}
return proc_dir_fd;
#include "defines.h"
#include "prototypes.h"
#include "shadowlog.h"
+#include "string/strerrno.h"
/*
if (a2i(time_t, &epoch, source_date_epoch, NULL, 10, 0, fallback) == -1) {
fprintf(shadow_logfd,
_("Environment variable $SOURCE_DATE_EPOCH: a2i(\"%s\"): %s"),
- source_date_epoch, strerror(errno));
+ source_date_epoch, strerrno());
return fallback;
}
return epoch;
#include "sizeof.h"
#include "string/sprintf/stpeprintf.h"
#include "string/strcmp/streq.h"
+#include "string/strerrno.h"
struct map_range *
fd = openat(proc_dir_fd, map_file, O_WRONLY);
if (fd < 0) {
fprintf(log_get_logfd(), _("%s: open of %s failed: %s\n"),
- log_get_progname(), map_file, strerror(errno));
+ log_get_progname(), map_file, strerrno());
exit(EXIT_FAILURE);
}
if (write_full(fd, buf, pos - buf) == -1) {
fprintf(log_get_logfd(), _("%s: write to %s failed: %s\n"),
- log_get_progname(), map_file, strerror(errno));
+ log_get_progname(), map_file, strerrno());
exit(EXIT_FAILURE);
}
if (close(fd) != 0 && errno != EINTR) {
fprintf(log_get_logfd(), _("%s: closing %s failed: %s\n"),
- log_get_progname(), map_file, strerror(errno));
+ log_get_progname(), map_file, strerrno());
exit(EXIT_FAILURE);
}
free(buf);
#include "string/sprintf/aprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
static char *passwd_db_file = NULL;
|| (setreuid (getuid (), getuid ()) != 0)) {
fprintf (log_get_logfd(),
_("%s: failed to drop privileges (%s)\n"),
- log_get_progname(), strerror (errno));
+ log_get_progname(), strerrno());
exit (EXIT_FAILURE);
}
#include "shadowlog.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
#include <assert.h>
if ( (setregid (getgid (), getgid ()) != 0)
|| (setreuid (getuid (), getuid ()) != 0)) {
fprintf (log_get_logfd(), _("%s: failed to drop privileges (%s)\n"),
- log_get_progname(), strerror (errno));
+ log_get_progname(), strerrno());
exit (EXIT_FAILURE);
}
if (access (newroot, F_OK) != 0) {
fprintf(log_get_logfd(),
_("%s: cannot access chroot directory %s: %s\n"),
- log_get_progname(), newroot, strerror (errno));
+ log_get_progname(), newroot, strerrno());
exit (E_BAD_ARG);
}
if (chroot (newroot) != 0) {
fprintf(log_get_logfd(),
_("%s: unable to chroot to directory %s: %s\n"),
- log_get_progname(), newroot, strerror (errno));
+ log_get_progname(), newroot, strerrno());
exit (E_BAD_ARG);
}
if (chdir ("/") != 0) {
fprintf(log_get_logfd(),
_("%s: cannot chdir in chroot directory %s: %s\n"),
- log_get_progname(), newroot, strerror (errno));
+ log_get_progname(), newroot, strerrno());
exit (E_BAD_ARG);
}
}
#include "run_part.h"
#include "shadowlog_internal.h"
#include "string/sprintf/aprintf.h"
+#include "string/strerrno.h"
static int run_part(char *script_path, const char *name, const char *action)
pid=fork();
if (pid==-1) {
- fprintf(shadow_logfd, "fork: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "fork: %s\n", strerrno());
return 1;
}
if (pid==0) {
setenv("ACTION",action,1);
setenv("SUBJECT",name,1);
execv(script_path,args);
- fprintf(shadow_logfd, "execv: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "execv: %s\n", strerrno());
_exit(1);
}
return (wait_status);
}
- fprintf(shadow_logfd, "waitpid: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "waitpid: %s\n", strerrno());
return (1);
}
s = aprintf("%s/%s", directory, namelist[n]->d_name);
if (s == NULL) {
- fprintf(shadow_logfd, "aprintf: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "aprintf: %s\n", strerrno());
for (; n<scanlist; n++) {
free(namelist[n]);
}
execute_result = 0;
if (stat(s, &sb) == -1) {
- fprintf(shadow_logfd, "stat: %s\n", strerror(errno));
+ fprintf(shadow_logfd, "stat: %s\n", strerrno());
free(s);
for (; n<scanlist; n++) {
free(namelist[n]);
#include "prototypes.h"
#include "shadowlog_internal.h"
#include "string/sprintf/aprintf.h"
+#include "string/strerrno.h"
static bool selinux_checked = false;
if (getprevcon_raw (&user_context_raw) != 0) {
fprintf (shadow_logfd,
_("%s: can not get previous SELinux process context: %s\n"),
- shadow_progname, strerror (errno));
+ shadow_progname, strerrno());
SYSLOG ((LOG_WARN,
"can not get previous SELinux process context: %s",
- strerror (errno)));
+ strerrno()));
return (security_getenforce () != 0);
}
#include <unistd.h>
#include <errno.h>
#include <string.h>
+
#include "exitcodes.h"
#include "prototypes.h"
-
#include "shadowlog_internal.h"
+#include "string/strerrno.h"
+
int
run_command(const char *cmd, const char *argv[],
_exit (E_CMD_NOTFOUND);
}
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
- shadow_progname, cmd, strerror (errno));
+ shadow_progname, cmd, strerrno());
_exit (E_CMD_NOEXEC);
} else if ((pid_t)-1 == pid) {
fprintf (shadow_logfd, "%s: cannot execute %s: %s\n",
- shadow_progname, cmd, strerror (errno));
+ shadow_progname, cmd, strerrno());
return -1;
}
if ((pid_t)-1 == wpid) {
fprintf (shadow_logfd, "%s: waitpid (status: %d): %s\n",
- shadow_progname, *status, strerror (errno));
+ shadow_progname, *status, strerrno());
return -1;
}
#include "shadowlog_internal.h"
#include "string/sprintf/aprintf.h"
#include "string/strcmp/streq.h"
+#include "string/strerrno.h"
#define SHADOWTCB_HASH_BY 1000
if (lstat (path, &st) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot stat %s: %s\n"),
- shadow_progname, path, strerror (errno));
+ shadow_progname, path, strerrno());
free (path);
return NULL;
}
if (READLINKNUL(path, link) == -1) {
fprintf (shadow_logfd,
_("%s: Cannot read symbolic link %s: %s\n"),
- shadow_progname, path, strerror (errno));
+ shadow_progname, path, strerrno());
free (path);
return NULL;
}
if (stat (TCB_DIR, &st) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot stat %s: %s\n"),
- shadow_progname, TCB_DIR, strerror (errno));
+ shadow_progname, TCB_DIR, strerrno());
goto out_free_path;
}
while (NULL != (ind = strchr(ptr, '/'))) {
if ((mkdir (dir, 0700) != 0) && (errno != EEXIST)) {
fprintf (shadow_logfd,
_("%s: Cannot create directory %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
goto out_free_dir;
}
if (chown (dir, 0, st.st_gid) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owner of %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
goto out_free_dir;
}
if (chmod (dir, 0711) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
goto out_free_dir;
}
free (dir);
if ((unlink (tmp) != 0) && (errno != ENOENT)) {
fprintf (shadow_logfd,
_("%s: unlink: %s: %s\n"),
- shadow_progname, tmp, strerror (errno));
+ shadow_progname, tmp, strerrno());
free (tmp);
return SHADOWTCB_FAILURE;
}
if (errno != ENOTEMPTY) {
fprintf (shadow_logfd,
_("%s: Cannot remove directory %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
ret = SHADOWTCB_FAILURE;
}
free (dir);
if (stat (olddir, &oldmode) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot stat %s: %s\n"),
- shadow_progname, olddir, strerror (errno));
+ shadow_progname, olddir, strerrno());
goto out_free;
}
old_uid = oldmode.st_uid;
if (rename (real_old_dir, real_new_dir) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot rename %s to %s: %s\n"),
- shadow_progname, real_old_dir, real_new_dir, strerror (errno));
+ shadow_progname, real_old_dir, real_new_dir, strerrno());
goto out_free;
}
if (rmdir_leading (real_old_dir_rel) == SHADOWTCB_FAILURE) {
if ((unlink (olddir) != 0) && (errno != ENOENT)) {
fprintf (shadow_logfd,
_("%s: Cannot remove %s: %s\n"),
- shadow_progname, olddir, strerror (errno));
+ shadow_progname, olddir, strerrno());
goto out_free;
}
newdir = aprintf(TCB_DIR "/%s", user_newname);
&& (symlink (real_new_dir_rel, newdir) != 0)) {
fprintf (shadow_logfd,
_("%s: Cannot create symbolic link %s: %s\n"),
- shadow_progname, real_new_dir_rel, strerror (errno));
+ shadow_progname, real_new_dir_rel, strerrno());
goto out_free;
}
ret = SHADOWTCB_SUCCESS;
if (stat (tcbdir, &dirmode) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot stat %s: %s\n"),
- shadow_progname, tcbdir, strerror (errno));
+ shadow_progname, tcbdir, strerrno());
goto out_free;
}
if (chown (tcbdir, 0, 0) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owners of %s: %s\n"),
- shadow_progname, tcbdir, strerror (errno));
+ shadow_progname, tcbdir, strerrno());
goto out_free;
}
if (chmod (tcbdir, 0700) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, tcbdir, strerror (errno));
+ shadow_progname, tcbdir, strerrno());
goto out_free;
}
if (lstat (shadow, &filemode) != 0) {
if (errno != ENOENT) {
fprintf (shadow_logfd,
_("%s: Cannot lstat %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
fprintf (shadow_logfd,
if (chown (shadow, user_newid, filemode.st_gid) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owner of %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
if (chmod (shadow, filemode.st_mode & 07777) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
}
if (chown (tcbdir, user_newid, dirmode.st_gid) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owner of %s: %s\n"),
- shadow_progname, tcbdir, strerror (errno));
+ shadow_progname, tcbdir, strerrno());
goto out_free;
}
if (chmod (tcbdir, dirmode.st_mode & 07777) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, tcbdir, strerror (errno));
+ shadow_progname, tcbdir, strerrno());
goto out_free;
}
ret = SHADOWTCB_SUCCESS;
if (stat (TCB_DIR, &tcbdir_stat) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot stat %s: %s\n"),
- shadow_progname, TCB_DIR, strerror (errno));
+ shadow_progname, TCB_DIR, strerrno());
return SHADOWTCB_FAILURE;
}
shadowgid = tcbdir_stat.st_gid;
}
if (mkdir (dir, 0700) != 0) {
fprintf (shadow_logfd,
- _("%s: mkdir: %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ _("%s: mkdir: %s: %s\n"), shadow_progname, dir, strerrno());
goto out_free;
}
fd = open (shadow, O_RDWR | O_CREAT | O_TRUNC, 0600);
if (fd < 0) {
fprintf (shadow_logfd,
_("%s: Cannot open %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
if (fchown (fd, 0, authgid) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owner of %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
if (fchmod (fd, (mode_t) ((authgid == shadowgid) ? 0600 : 0640)) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, shadow, strerror (errno));
+ shadow_progname, shadow, strerrno());
goto out_free;
}
if (chown (dir, 0, authgid) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change owner of %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
goto out_free;
}
if (chmod (dir, (mode_t) ((authgid == shadowgid) ? 02700 : 02710)) != 0) {
fprintf (shadow_logfd,
_("%s: Cannot change mode of %s: %s\n"),
- shadow_progname, dir, strerror (errno));
+ shadow_progname, dir, strerrno());
goto out_free;
}
if ( (shadowtcb_set_user (name) == SHADOWTCB_FAILURE)
#include "string/strcmp/streq.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "string/strftime.h"
#include "time/day_to_str.h"
/*@-exitarg@*/
if (lflg && ( (setregid (rgid, rgid) != 0)
|| (setreuid (ruid, ruid) != 0))) {
fprintf (stderr, _("%s: failed to drop privileges (%s)\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
fail_exit (E_NOPERM, process_selinux);
}
#include "shadow/gshadow/sgrp.h"
#include "shadowlog.h"
#include "string/strcmp/streq.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
/*
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
fail_exit (1, process_selinux);
}
}
#include "exitcodes.h"
#include "shadowlog.h"
#include "string/strcmp/streq.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
fail_exit (1, process_selinux);
}
}
#include "exitcodes.h"
#include "shadowlog.h"
#include "string/memset/memzero.h"
+#include "string/strerrno.h"
#include "string/strftime.h"
if (NULL == fail) {
fprintf (stderr,
_("%s: Cannot open %s: %s\n"),
- Prog, FAILLOG_FILE, strerror (errno));
+ Prog, FAILLOG_FILE, strerrno());
exit (E_NOPERM);
}
if (fstat (fileno (fail), &statbuf) != 0) {
fprintf (stderr,
_("%s: Cannot get the size of %s: %s\n"),
- Prog, FAILLOG_FILE, strerror (errno));
+ Prog, FAILLOG_FILE, strerrno());
exit (E_NOPERM);
}
|| (fclose (fail) != 0)) {
fprintf (stderr,
_("%s: Failed to write %s: %s\n"),
- Prog, FAILLOG_FILE, strerror (errno));
+ Prog, FAILLOG_FILE, strerrno());
(void) fclose (fail);
errors = true;
}
#include "string/strcmp/streq.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
+
struct option_flags {
bool chroot;
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
exit (1);
}
#ifdef SHADOWGRP
#include "shadow/gshadow/sgrp.h"
#include "shadowlog.h"
#include "string/memset/memzero.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
/* And now open the databases */
if (gr_open (O_CREAT | O_RDWR) == 0) {
- fprintf (stderr, _("%s: cannot open %s: %s\n"), Prog, gr_dbname (), strerror(errno));
- SYSLOG ((LOG_WARN, "cannot open %s: %s", gr_dbname (), strerror(errno)));
+ fprintf(stderr, _("%s: cannot open %s: %s\n"), Prog, gr_dbname(), strerrno());
+ SYSLOG((LOG_WARN, "cannot open %s: %s", gr_dbname(), strerrno()));
fail_exit (E_GRP_UPDATE);
}
if (sgr_open (O_CREAT | O_RDWR) == 0) {
fprintf (stderr,
_("%s: cannot open %s: %s\n"),
- Prog, sgr_dbname (), strerror(errno));
- SYSLOG ((LOG_WARN, "cannot open %s: %s", sgr_dbname (), strerror(errno)));
+ Prog, sgr_dbname(), strerrno());
+ SYSLOG((LOG_WARN, "cannot open %s: %s", sgr_dbname(), strerrno()));
fail_exit (E_GRP_UPDATE);
}
}
#include "shadowlog.h"
#include "sizeof.h"
#include "string/memset/memzero.h"
+#include "string/strerrno.h"
#include "string/strftime.h"
if (fstat (fileno (lastlogfile), &statbuf) != 0) {
fprintf (stderr,
_("%s: Cannot get the size of %s: %s\n"),
- Prog, _PATH_LASTLOG, strerror(errno));
+ Prog, _PATH_LASTLOG, strerrno());
exit (EXIT_FAILURE);
}
#include "string/strcmp/strprefix.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "string/strftime.h"
child = fork ();
if (child < 0) {
/* error in fork() */
- fprintf (stderr, _("%s: failure forking: %s"),
- Prog, strerror (errno));
+ fprintf(stderr, _("%s: failure forking: %s"), Prog, strerrno());
PAM_END;
exit (0);
} else if (child != 0) {
#include "prototypes.h"
#include "shadowlog.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
#include "subordinateio.h"
goto out;
}
fprintf(stderr, _("%s: couldn't open process setgroups: %s\n"),
- Prog,
- strerror(errno));
+ Prog, strerrno());
exit(EXIT_FAILURE);
}
*/
if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) {
fprintf(stderr, _("%s: failed to read setgroups: %s\n"),
- Prog,
- strerror(errno));
+ Prog, strerrno());
exit(EXIT_FAILURE);
}
if (strprefix(policy_buffer, policy))
/* Write the policy. */
if (lseek(setgroups_fd, 0, SEEK_SET) < 0) {
fprintf(stderr, _("%s: failed to seek setgroups: %s\n"),
- Prog,
- strerror(errno));
+ Prog, strerrno());
exit(EXIT_FAILURE);
}
if (dprintf(setgroups_fd, "%s", policy) < 0) {
fprintf(stderr, _("%s: failed to setgroups %s policy: %s\n"),
- Prog,
- policy,
- strerror(errno));
+ Prog, policy, strerrno());
exit(EXIT_FAILURE);
}
if (fstat(proc_dir_fd, &st) < 0) {
fprintf(stderr,
_("%s: Could not stat directory for target process: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
return EXIT_FAILURE;
}
if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
fprintf (stderr,
_("%s: cannot open %s: %s\n"),
- Prog, sub_gid_dbname (), strerror (errno));
+ Prog, sub_gid_dbname(), strerrno());
return EXIT_FAILURE;
}
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include <assert.h>
if (NULL == cpasswd) {
fprintf (stderr,
_("%s: failed to crypt password with previous salt: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
SYSLOG ((LOG_INFO,
"Failed to crypt password with previous salt of group '%s'",
groupname));
if ((pid_t)-1 == child) {
/* error in fork() */
fprintf (stderr, _("%s: failure forking: %s\n"),
- is_newgrp ? "newgrp" : "sg", strerror (errno));
+ is_newgrp ? "newgrp" : "sg", strerrno());
#ifdef WITH_AUDIT
if (group) {
audit_logger_with_group(AUDIT_CHGRP_ID, "changing", NULL,
#include "prototypes.h"
#include "shadowlog.h"
#include "string/strcmp/strprefix.h"
+#include "string/strerrno.h"
#include "subordinateio.h"
if (fstat(proc_dir_fd, &st) < 0) {
fprintf(stderr,
_("%s: Could not stat directory for target process: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
return EXIT_FAILURE;
}
if (want_subuid_file() && !sub_uid_open(O_RDONLY)) {
fprintf (stderr,
_("%s: cannot open %s: %s\n"),
- Prog, sub_uid_dbname (), strerror (errno));
+ Prog, sub_uid_dbname(), strerrno());
return EXIT_FAILURE;
}
#include "string/sprintf/snprintf.h"
#include "string/strcmp/streq.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
#include "string/strtok/strsep2arr.h"
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
return 1;
}
pwd->pw_passwd = cp;
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
return 1;
}
spent.sp_pwdp = cp;
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
return 1;
}
spent.sp_pwdp = cp;
usernames = REALLOCF(usernames, nusers, char *);
passwords = REALLOCF(passwords, nusers, char *);
if (lines == NULL || usernames == NULL || passwords == NULL) {
- fprintf (stderr,
- _("%s: line %jd: %s\n"),
- Prog, line, strerror(errno));
+ fprintf(stderr, _("%s: line %jd: %s\n"), Prog, line, strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
}
lines[nusers-1] = line;
if (mkdir (newpw.pw_dir, mode) != 0) {
fprintf (stderr,
_("%s: line %jd: mkdir %s failed: %s\n"),
- Prog, line, newpw.pw_dir,
- strerror (errno));
+ Prog, line, newpw.pw_dir, strerrno());
if (errno != EEXIST) {
fail_exit (EXIT_FAILURE, process_selinux);
}
{
fprintf (stderr,
_("%s: line %jd: chown %s failed: %s\n"),
- Prog, line, newpw.pw_dir,
- strerror (errno));
+ Prog, line, newpw.pw_dir, strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
}
}
#include "string/strcmp/strprefix.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "time/day_to_str.h"
erase_pass (clear);
fprintf (stderr,
_("%s: failed to crypt password with previous salt: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
SYSLOG ((LOG_INFO,
"Failed to crypt password with previous salt of user '%s'",
pw->pw_name));
if (NULL == cp) {
fprintf (stderr,
_("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerror (errno));
+ Prog, salt, strerrno());
return -1;
}
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
new_file = aprintf("%s%s%s", prefix, prefix[0]?"/":"", NEW_USER_FILE);
if (new_file == NULL) {
fprintf(stderr, _("%s: cannot create new defaults file: %s\n"),
- Prog, strerror(errno));
+ Prog, strerrno());
return -1;
}
if (default_file == NULL) {
fprintf(stderr,
_("%s: cannot create new defaults file: %s\n"),
- Prog, strerror(errno));
+ Prog, strerrno());
goto err_free_new;
}
}
assert(SNPRINTF(buf, "%s-", default_file) != -1);
unlink (buf);
if ((link (default_file, buf) != 0) && (ENOENT != errno)) {
- int err = errno;
fprintf (stderr,
_("%s: Cannot create backup file (%s): %s\n"),
- Prog, buf, strerror (err));
+ Prog, buf, strerrno());
unlink (new_file);
goto err_free_def;
}
* Rename the new default file to its correct name.
*/
if (rename (new_file, default_file) != 0) {
- int err = errno;
fprintf (stderr,
_("%s: rename: %s: %s\n"),
- Prog, new_file, strerror (err));
+ Prog, new_file, strerrno());
goto err_free_def;
}
#ifdef WITH_AUDIT
if (-1 == fd) {
fprintf (stderr,
_("%s: failed to open the faillog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to open the faillog file for UID %lu", (unsigned long) uid));
return;
}
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to reset the faillog entry of UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to reset the faillog entry of UID %lu", (unsigned long) uid));
}
if (close (fd) != 0 && errno != EINTR) {
fprintf (stderr,
_("%s: failed to close the faillog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to close the faillog file for UID %lu", (unsigned long) uid));
}
}
if (-1 == fd) {
fprintf (stderr,
_("%s: failed to open the lastlog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to open the lastlog file for UID %lu", (unsigned long) uid));
return;
}
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to reset the lastlog entry of UID %lu", (unsigned long) uid));
/* continue */
}
if (close (fd) != 0 && errno != EINTR) {
fprintf (stderr,
_("%s: failed to close the lastlog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerror (errno));
+ Prog, (unsigned long) uid, strerrno());
SYSLOG ((LOG_WARN, "failed to close the lastlog file for UID %lu", (unsigned long) uid));
/* continue */
}
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
/*
} else {
fprintf (stderr,
_("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerror (errno));
- SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
+ Prog, mailfile, strerrno());
+ SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog,
"delete-mail-file",
if (unlink (mailfile) != 0) {
fprintf (stderr,
_("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerror (errno));
- SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
+ Prog, mailfile, strerrno());
+ SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog,
"delete-mail-file",
fprintf (stderr,
_("%s: %s not owned by %s, not removing\n"),
Prog, mailfile, user_name);
- SYSLOG ((LOG_ERR,
- "%s not owned by %s, not removed",
- mailfile, strerror (errno)));
+ SYSLOG((LOG_ERR, "%s not owned by %s, not removed", mailfile, strerrno()));
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog,
"delete-mail-file",
if (unlink (mailfile) != 0) {
fprintf (stderr,
_("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerror (errno));
- SYSLOG ((LOG_ERR, "Cannot remove %s: %s", mailfile, strerror (errno)));
+ Prog, mailfile, strerrno());
+ SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()));
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog,
"delete-mail-file",
}
if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
fprintf (stderr, _("%s: Cannot drop privileges: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
shadowtcb_gain_priv ();
free (buf);
return 1;
*/
if (remove_tree (buf, false) != 0) {
fprintf (stderr, _("%s: Cannot remove the content of %s: %s\n"),
- Prog, buf, strerror (errno));
+ Prog, buf, strerrno());
shadowtcb_gain_priv ();
free (buf);
return 1;
free (buf);
if (shadowtcb_remove (user_name) == SHADOWTCB_FAILURE) {
fprintf (stderr, _("%s: Cannot remove tcb files for %s: %s\n"),
- Prog, user_name, strerror (errno));
+ Prog, user_name, strerrno());
ret = 1;
}
return ret;
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
+#include "string/strerrno.h"
#include "time/day_to_str.h"
#include "typetraits.h"
if (!entry) {
fprintf (stderr,
_("%s: failed to allocate memory: %s\n"),
- Prog, strerror (errno));
+ Prog, strerrno());
return 0;
}
entry->next = *head;
if (-1 == fd) {
fprintf (stderr,
_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
return;
}
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
}
} else {
/* Assume lseek or read failed because there is
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
}
}
}
if (close (fd) != 0 && errno != EINTR) {
fprintf (stderr,
_("%s: failed to copy the lastlog entry of user %ju to user %ju: %s\n"),
- Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerror (errno));
+ Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerrno());
}
}
#endif /* ENABLE_LASTLOG */
if (-1 == fd) {
fprintf (stderr,
_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
return;
}
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
}
} else {
/* Assume lseek or read failed because there is
{
fprintf (stderr,
_("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),
- Prog, (unsigned long) user_id, (unsigned long) user_newid, strerror (errno));
+ Prog, (unsigned long) user_id, (unsigned long) user_newid, strerrno());
}
}
}
if (close (fd) != 0 && errno != EINTR) {
fprintf (stderr,
_("%s: failed to copy the faillog entry of user %ju to user %ju: %s\n"),
- Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerror (errno));
+ Prog, (uintmax_t) user_id, (uintmax_t) user_newid, strerrno());
}
}
#include "string/sprintf/aprintf.h"
#include "string/sprintf/snprintf.h"
#include "string/strcmp/streq.h"
+#include "string/strerrno.h"
#define MSG_WARN_EDIT_OTHER_FILE _( \
status = system (buf);
if (-1 == status) {
- fprintf (stderr, _("%s: %s: %s\n"), Prog, editor,
- strerror (errno));
+ fprintf(stderr, _("%s: %s: %s\n"), Prog, editor, strerrno());
exit (1);
} else if ( WIFEXITED (status)
&& (WEXITSTATUS (status) != 0)) {
editor_pgrp = tcgetpgrp(STDIN_FILENO);
if (editor_pgrp == -1) {
fprintf (stderr, "%s: %s: %s", Prog,
- "tcgetpgrp", strerror (errno));
+ "tcgetpgrp", strerrno());
}
if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) {
fprintf (stderr, "%s: %s: %s", Prog,
- "tcsetpgrp", strerror (errno));
+ "tcsetpgrp", strerrno());
}
}
kill (getpid (), SIGSTOP);
if (editor_pgrp != -1) {
if (tcsetpgrp(STDIN_FILENO, editor_pgrp) == -1) {
fprintf (stderr, "%s: %s: %s", Prog,
- "tcsetpgrp", strerror (errno));
+ "tcsetpgrp", strerrno());
}
}
killpg (pid, SIGCONT);
if (orig_pgrp != -1) {
/* Restore terminal pgrp after editing. */
if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) {
- fprintf(stderr, "%s: %s: %s", Prog,
- "tcsetpgrp", strerror(errno));
+ fprintf(stderr, "%s: %s: %s", Prog, "tcsetpgrp", strerrno());
}
sigprocmask(SIG_SETMASK, &omask, NULL);
}
if (rename (to_rename, file) == -1) {
fprintf (stderr,
_("%s: can't restore %s: %s (your changes are in %s)\n"),
- Prog, file, strerror (errno), to_rename);
+ Prog, file, strerrno(), to_rename);
#ifdef WITH_TCB
if (tcb_mode) {
free(to_rename);