#include <sys/types.h>
#include "alloc/reallocf.h"
+#include "io/fprintf.h"
#include "search/l/lsearch.h"
#include "shadow/grp/agetgroups.h"
#include "shadowlog.h"
#include "string/strchr/strchrscnt.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
/*
free(dup);
if (setgroups(n, gids) == -1) {
- fprintf(log_get_logfd(), "setgroups: %s\n", strerrno());
+ fprinte(log_get_logfd(), "setgroups");
goto free_gids;
}
#include <stdio.h>
#include <errno.h>
#include <grp.h>
-#include "prototypes.h"
-#include "defines.h"
#include <pwd.h>
+
+#include "defines.h"
#include "getdef.h"
+#include "io/fprintf.h"
+#include "prototypes.h"
#include "shadowlog.h"
/*
|| (fchmod (STDIN_FILENO, getdef_num ("TTYPERM", 0600)) != 0)) {
int err = errno;
- fprintf (log_get_logfd(),
- _("Unable to change owner or mode of tty stdin: %s"),
- strerror (err));
+ fprinte(log_get_logfd(), _("Unable to change owner or mode of tty stdin"));
SYSLOG(LOG_WARN,
"unable to change owner or mode of tty stdin for user `%s': %s\n",
info->pw_name, strerror(err));
#include "commonio.h"
#include "defines.h"
#include "fs/mkstemp/fmkomstemp.h"
+#include "io/fprintf.h"
#include "nscd.h"
#ifdef WITH_TCB
#include <tcb.h>
#include "string/sprintf/stprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
-#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
#undef NDEBUG
if (stat (file, &sb) != 0) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: %s file stat error: %s\n",
- log_get_progname(), file, strerrno());
+ fprinte(log_get_logfd(), "%s: %s file stat error",
+ log_get_progname(), file);
}
return 0;
}
fd = open (file, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (-1 == fd) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: %s: %s\n",
- log_get_progname(), file, strerrno());
+ fprinte(log_get_logfd(), "%s: %s", log_get_progname(), file);
}
return 0;
}
len = (ssize_t) strlen (buf) + 1;
if (write_full(fd, buf, len) == -1) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: %s file write error: %s\n",
- log_get_progname(), file, strerrno());
+ fprinte(log_get_logfd(), "%s: %s file write error",
+ log_get_progname(), file);
}
(void) close (fd);
unlink (file);
}
if (fdatasync (fd) == -1) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: %s file sync error: %s\n",
- log_get_progname(), file, strerrno());
+ fprinte(log_get_logfd(), "%s: %s file sync error",
+ log_get_progname(), file);
}
(void) close (fd);
unlink (file);
fd = open (lock, O_RDWR);
if (-1 == fd) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: %s: %s\n",
- log_get_progname(), lock, strerrno());
+ fprinte(log_get_logfd(), "%s: %s", log_get_progname(), lock);
}
unlink (file);
errno = EINVAL;
}
if (unlink (lock) != 0) {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: cannot get lock %s: %s\n",
- log_get_progname(), lock, strerrno());
+ fprinte(log_get_logfd(), "%s: cannot get lock %s",
+ log_get_progname(), lock);
}
unlink (file);
return 0;
retval = check_link_count (file, log);
} else {
if (log) {
- (void) fprintf (log_get_logfd(),
- "%s: cannot get lock %s: %s\n",
- log_get_progname(), lock, strerrno());
+ fprinte(log_get_logfd(), "%s: cannot get lock %s",
+ log_get_progname(), lock);
}
}
#include <stdio.h>
#include <stdlib.h>
+#include "io/fprintf.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(), strerrno());
+ fprinte(log_get_logfd(), "%s", log_get_progname());
exit(13);
}
}
#include <errno.h>
#include "alloc/calloc.h"
-#include "prototypes.h"
#include "groupio.h"
#include "getdef.h"
+#include "io/fprintf.h"
+#include "prototypes.h"
#include "shadowlog.h"
-#include "string/strerrno.h"
#undef NDEBUG
/* Create an array to hold all of the discovered GIDs */
used_gids = calloc_T(gid_max + 1, bool);
if (NULL == used_gids) {
- fprintf (log_get_logfd(),
- _("%s: failed to allocate memory: %s\n"),
- log_get_progname(), strerrno());
+ fprinte(log_get_logfd(), _("%s: failed to allocate memory"),
+ log_get_progname());
return -1;
}
#include "prototypes.h"
#include "pwio.h"
#include "getdef.h"
+#include "io/fprintf.h"
#include "shadowlog.h"
-#include "string/strerrno.h"
#undef NDEBUG
#include <assert.h>
/* Create an array to hold all of the discovered UIDs */
used_uids = calloc_T(uid_max + 1, bool);
if (NULL == used_uids) {
- fprintf (log_get_logfd(),
- _("%s: failed to allocate memory: %s\n"),
- log_get_progname(), strerrno());
+ fprinte(log_get_logfd(), _("%s: failed to allocate memory"),
+ log_get_progname());
return -1;
}
#include "defines.h"
#include "atoi/getnum.h"
#include "defines.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "string/sprintf/stprintf.h"
-#include "string/strerrno.h"
/*
return -ENOENT;
if (stprintf_a(proc_dir_name, "/proc/%d/", target) == -1) {
- fprintf(stderr, "snprintf of proc path failed for %d: %s\n",
- target, strerrno());
+ fprinte(stderr, "snprintf of proc path failed for %d", target);
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, strerrno());
+ fprinte(stderr, _("Could not open proc directory for target %d"), target);
return -EINVAL;
}
return proc_dir_fd;
#include "atoi/a2i.h"
#include "defines.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
-#include "string/strerrno.h"
/*
return fallback;
if (a2i(time_t, &epoch, source_date_epoch, NULL, 10, 0, fallback) == -1) {
- fprintf(log_get_logfd(),
- _("Environment variable $SOURCE_DATE_EPOCH: a2i(\"%s\"): %s"),
- source_date_epoch, strerrno());
+ fprinte(log_get_logfd(),
+ _("Environment variable $SOURCE_DATE_EPOCH: a2i(\"%s\")"),
+ source_date_epoch);
return fallback;
}
return epoch;
#include "atoi/a2i.h"
#include "attr.h"
#include "idmapping.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "sizeof.h"
#include "string/sprintf/seprintf.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
struct map_range *
/* Write the mapping to the mapping file */
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, strerrno());
+ fprinte(log_get_logfd(), _("%s: open of %s failed"),
+ log_get_progname(), map_file);
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, strerrno());
+ fprinte(log_get_logfd(), _("%s: write to %s failed"),
+ log_get_progname(), map_file);
exit(EXIT_FAILURE);
}
if (close(fd) != 0 && errno != EINTR) {
- fprintf(log_get_logfd(), _("%s: closing %s failed: %s\n"),
- log_get_progname(), map_file, strerrno());
+ fprinte(log_get_logfd(), _("%s: closing %s failed"),
+ log_get_progname(), map_file);
exit(EXIT_FAILURE);
}
free(buf);
/*@-exitarg@*/
#include "exitcodes.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "pwio.h"
#ifdef SHADOWGRP
#include "sgroupio.h"
#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;
/* Drop privileges */
if ( (setregid (getgid (), getgid ()) != 0)
|| (setreuid (getuid (), getuid ()) != 0)) {
- fprintf (log_get_logfd(),
- _("%s: failed to drop privileges (%s)\n"),
- log_get_progname(), strerrno());
+ fprinte(log_get_logfd(), _("%s: failed to drop privileges"),
+ log_get_progname());
exit (EXIT_FAILURE);
}
#include "defines.h"
/*@-exitarg@*/
#include "exitcodes.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
-#include "string/strerrno.h"
static void change_root (const char* newroot);
/* Drop privileges */
if ( (setregid (getgid (), getgid ()) != 0)
|| (setreuid (getuid (), getuid ()) != 0)) {
- fprintf (log_get_logfd(), _("%s: failed to drop privileges (%s)\n"),
- log_get_progname(), strerrno());
+ fprinte(log_get_logfd(), _("%s: failed to drop privileges"),
+ log_get_progname());
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, strerrno());
+ fprinte(log_get_logfd(), _("%s: cannot access chroot directory %s"),
+ log_get_progname(), newroot);
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, strerrno());
+ fprinte(log_get_logfd(), _("%s: unable to chroot to directory %s"),
+ log_get_progname(), newroot);
exit (E_BAD_ARG);
}
if (chdir ("/") != 0) {
- fprintf(log_get_logfd(),
- _("%s: cannot chdir in chroot directory %s: %s\n"),
- log_get_progname(), newroot, strerrno());
+ fprinte(log_get_logfd(), _("%s: cannot chdir in chroot directory %s"),
+ log_get_progname(), newroot);
exit (E_BAD_ARG);
}
}
#include <unistd.h>
#include <lib/prototypes.h>
+#include "io/fprintf.h"
#include "run_part.h"
#include "shadowlog.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(log_get_logfd(), "fork: %s\n", strerrno());
+ fprinte(log_get_logfd(), "fork");
return 1;
}
if (pid==0) {
setenv("ACTION",action,1);
setenv("SUBJECT",name,1);
execv(script_path,args);
- fprintf(log_get_logfd(), "execv: %s\n", strerrno());
+ fprinte(log_get_logfd(), "execv");
_exit(1);
}
return (wait_status);
}
- fprintf(log_get_logfd(), "wait: %s\n", strerrno());
+ fprinte(log_get_logfd(), "wait");
return (1);
}
s = aprintf("%s/%s", directory, namelist[n]->d_name);
if (s == NULL) {
- fprintf(log_get_logfd(), "aprintf: %s\n", strerrno());
+ fprinte(log_get_logfd(), "aprintf");
for (; n<scanlist; n++) {
free(namelist[n]);
}
execute_result = 0;
if (stat(s, &sb) == -1) {
- fprintf(log_get_logfd(), "stat: %s\n", strerrno());
+ fprinte(log_get_logfd(), "stat");
free(s);
for (; n<scanlist; n++) {
free(namelist[n]);
#include <selinux/selinux.h>
#include <selinux/label.h>
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "string/sprintf/aprintf.h"
selinux_set_callback (SELINUX_CB_LOG, (union selinux_callback) { .func_log = selinux_log_cb });
if (getprevcon_raw (&user_context_raw) != 0) {
- fprintf (log_get_logfd(),
- _("%s: can not get previous SELinux process context: %s\n"),
- log_get_progname(), strerrno());
+ fprinte(log_get_logfd(), _("%s: can not get previous SELinux process context"),
+ log_get_progname());
SYSLOG(LOG_WARN,
"can not get previous SELinux process context: %s",
strerrno());
#include <string.h>
#include "exitcodes.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
-#include "string/strerrno.h"
int
if (ENOENT == errno) {
_exit (E_CMD_NOTFOUND);
}
- fprintf (log_get_logfd(), "%s: cannot execute %s: %s\n",
- log_get_progname(), cmd, strerrno());
+ fprinte(log_get_logfd(), "%s: cannot execute %s",
+ log_get_progname(), cmd);
_exit (E_CMD_NOEXEC);
} else if ((pid_t)-1 == pid) {
- fprintf (log_get_logfd(), "%s: cannot execute %s: %s\n",
- log_get_progname(), cmd, strerrno());
+ fprinte(log_get_logfd(), "%s: cannot execute %s",
+ log_get_progname(), cmd);
return -1;
}
|| ((pid_t)-1 != wpid && wpid != pid));
if ((pid_t)-1 == wpid) {
- fprintf (log_get_logfd(), "%s: waitpid (status: %d): %s\n",
- log_get_progname(), *status, strerrno());
+ fprinte(log_get_logfd(), "%s: waitpid (status: %d)",
+ log_get_progname(), *status);
return -1;
}
#include "defines.h"
#include "fs/readlink/readlinknul.h"
#include "getdef.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "tcbfuncs.h"
#include "shadowio.h"
#include "string/sprintf/aprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
-#include "string/strerrno.h"
#define SHADOWTCB_HASH_BY 1000
return NULL;
}
if (lstat (path, &st) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot stat %s: %s\n"),
- log_get_progname(), path, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot stat %s"), log_get_progname(), path);
free (path);
return NULL;
}
return NULL;
}
if (readlinknul_a(path, link) == -1) {
- fprintf (log_get_logfd(),
- _("%s: Cannot read symbolic link %s: %s\n"),
- log_get_progname(), path, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot read symbolic link %s"),
+ log_get_progname(), path);
free (path);
return NULL;
}
}
ptr = path;
if (stat (TCB_DIR, &st) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot stat %s: %s\n"),
- log_get_progname(), TCB_DIR, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot stat %s"),
+ log_get_progname(), TCB_DIR);
goto out_free_path;
}
while (NULL != (ind = strchr(ptr, '/'))) {
return SHADOWTCB_FAILURE;
}
if ((mkdir (dir, 0700) != 0) && (errno != EEXIST)) {
- fprintf (log_get_logfd(),
- _("%s: Cannot create directory %s: %s\n"),
- log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot create directory %s"),
+ log_get_progname(), dir);
goto out_free_dir;
}
if (chown (dir, 0, st.st_gid) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owner of %s: %s\n"),
- log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owner of %s"),
+ log_get_progname(), dir);
goto out_free_dir;
}
if (chmod (dir, 0711) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), dir);
goto out_free_dir;
}
free (dir);
return SHADOWTCB_FAILURE;
}
if ((unlink (tmp) != 0) && (errno != ENOENT)) {
- fprintf (log_get_logfd(),
- _("%s: unlink: %s: %s\n"),
- log_get_progname(), tmp, strerrno());
+ fprinte(log_get_logfd(), "%s: unlink: %s", log_get_progname(), tmp);
free (tmp);
return SHADOWTCB_FAILURE;
}
if (rmdir(path) != 0) {
if (errno != ENOTEMPTY) {
- fprintf (log_get_logfd(),
- _("%s: Cannot remove directory %s: %s\n"),
- log_get_progname(), path, strerrno());
+ fprinte(log_get_logfd(),
+ _("%s: Cannot remove directory %s"),
+ log_get_progname(), path);
ret = SHADOWTCB_FAILURE;
}
break;
goto out_free_nomem;
}
if (stat (olddir, &oldmode) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot stat %s: %s\n"),
- log_get_progname(), olddir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot stat %s"),
+ log_get_progname(), olddir);
goto out_free;
}
old_uid = oldmode.st_uid;
goto out_free;
}
if (rename (real_old_dir, real_new_dir) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot rename %s to %s: %s\n"),
- log_get_progname(), real_old_dir, real_new_dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot rename %s to %s"),
+ log_get_progname(), real_old_dir, real_new_dir);
goto out_free;
}
if (rmdir_leading (real_old_dir_rel) == SHADOWTCB_FAILURE) {
goto out_free;
}
if ((unlink (olddir) != 0) && (errno != ENOENT)) {
- fprintf (log_get_logfd(),
- _("%s: Cannot remove %s: %s\n"),
- log_get_progname(), olddir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot remove %s"),
+ log_get_progname(), olddir);
goto out_free;
}
newdir = aprintf(TCB_DIR "/%s", user_newname);
}
if ( !streq(real_new_dir, newdir)
&& (symlink (real_new_dir_rel, newdir) != 0)) {
- fprintf (log_get_logfd(),
- _("%s: Cannot create symbolic link %s: %s\n"),
- log_get_progname(), real_new_dir_rel, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot create symbolic link %s"),
+ log_get_progname(), real_new_dir_rel);
goto out_free;
}
ret = SHADOWTCB_SUCCESS;
return SHADOWTCB_FAILURE;
}
if (stat (tcbdir, &dirmode) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot stat %s: %s\n"),
- log_get_progname(), tcbdir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot stat %s"),
+ log_get_progname(), tcbdir);
goto out_free;
}
if (chown (tcbdir, 0, 0) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owners of %s: %s\n"),
- log_get_progname(), tcbdir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owners of %s"),
+ log_get_progname(), tcbdir);
goto out_free;
}
if (chmod (tcbdir, 0700) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), tcbdir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), tcbdir);
goto out_free;
}
if (lstat (shadow, &filemode) != 0) {
if (errno != ENOENT) {
- fprintf (log_get_logfd(),
- _("%s: Cannot lstat %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot lstat %s"),
+ log_get_progname(), shadow);
goto out_free;
}
fprintf (log_get_logfd(),
goto out_free;
}
if (chown (shadow, user_newid, filemode.st_gid) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owner of %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owner of %s"),
+ log_get_progname(), shadow);
goto out_free;
}
if (chmod (shadow, filemode.st_mode & 07777) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), shadow);
goto out_free;
}
}
goto out_free;
}
if (chown (tcbdir, user_newid, dirmode.st_gid) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owner of %s: %s\n"),
- log_get_progname(), tcbdir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owner of %s"),
+ log_get_progname(), tcbdir);
goto out_free;
}
if (chmod (tcbdir, dirmode.st_mode & 07777) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), tcbdir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), tcbdir);
goto out_free;
}
ret = SHADOWTCB_SUCCESS;
return SHADOWTCB_SUCCESS;
}
if (stat (TCB_DIR, &tcbdir_stat) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot stat %s: %s\n"),
- log_get_progname(), TCB_DIR, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot stat %s"),
+ log_get_progname(), TCB_DIR);
return SHADOWTCB_FAILURE;
}
shadowgid = tcbdir_stat.st_gid;
return SHADOWTCB_FAILURE;
}
if (mkdir (dir, 0700) != 0) {
- fprintf (log_get_logfd(),
- _("%s: mkdir: %s: %s\n"), log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), "%s: mkdir: %s", log_get_progname(), dir);
goto out_free;
}
fd = open (shadow, O_RDWR | O_CREAT | O_TRUNC, 0600);
if (fd < 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot open %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot open %s"),
+ log_get_progname(), shadow);
goto out_free;
}
if (fchown (fd, 0, authgid) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owner of %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owner of %s"),
+ log_get_progname(), shadow);
goto out_free;
}
if (fchmod (fd, (mode_t) ((authgid == shadowgid) ? 0600 : 0640)) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), shadow, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), shadow);
goto out_free;
}
if (chown (dir, 0, authgid) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change owner of %s: %s\n"),
- log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change owner of %s"),
+ log_get_progname(), dir);
goto out_free;
}
if (chmod (dir, (mode_t) ((authgid == shadowgid) ? 02700 : 02710)) != 0) {
- fprintf (log_get_logfd(),
- _("%s: Cannot change mode of %s: %s\n"),
- log_get_progname(), dir, strerrno());
+ fprinte(log_get_logfd(), _("%s: Cannot change mode of %s"),
+ log_get_progname(), dir);
goto out_free;
}
if ( (shadowtcb_set_user (name) == SHADOWTCB_FAILURE)
#include "atoi/a2i.h"
#include "defines.h"
#include "fields.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "pwio.h"
#include "shadowio.h"
#include "string/sprintf/stprintf.h"
#include "string/strcmp/streq.h"
#include "string/strcpy/strtcpy.h"
-#include "string/strerrno.h"
#include "string/strftime.h"
#include "time/day_to_str.h"
/*@-exitarg@*/
/* Drop privileges */
if (lflg && ( (setregid (rgid, rgid) != 0)
|| (setreuid (ruid, ruid) != 0))) {
- fprintf (stderr, _("%s: failed to drop privileges (%s)\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: failed to drop privileges"), Prog);
fail_exit (E_NOPERM, process_selinux);
}
#include "atoi/a2i.h"
#include "defines.h"
+#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "sssd.h"
#include "prototypes.h"
-#include "groupio.h"
#ifdef SHADOWGRP
#include "sgroupio.h"
#endif
#include "shadow/gshadow/sgrp.h"
#include "shadowlog.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
/*
salt = crypt_make_salt (crypt_method, arg);
cp = pw_encrypt (newpwd, salt);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
fail_exit (1, process_selinux);
}
}
#include "atoi/a2i.h"
#include "chkhash.h"
#include "defines.h"
+#include "getdef.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "sssd.h"
-#include "getdef.h"
#include "prototypes.h"
#include "pwio.h"
#include "shadowio.h"
#include "io/fgets/fgets.h"
#include "shadowlog.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
if (salt) {
cp = pw_encrypt (newpwd, salt);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
fail_exit (1, process_selinux);
}
}
#include "atoi/a2i.h"
#include "defines.h"
-#include "faillog.h"
-#include "prototypes.h"
/*@-exitarg@*/
#include "exitcodes.h"
+#include "faillog.h"
+#include "io/fprintf.h"
+#include "prototypes.h"
#include "shadowlog.h"
#include "string/memset/memzero.h"
-#include "string/strerrno.h"
#include "string/strftime.h"
#undef NDEBUG
fail = fopen (FAILLOG_FILE, "r");
}
if (NULL == fail) {
- fprintf (stderr,
- _("%s: Cannot open %s: %s\n"),
- Prog, FAILLOG_FILE, strerrno());
+ fprinte(stderr, _("%s: Cannot open %s"), Prog, FAILLOG_FILE);
exit (E_NOPERM);
}
/* Get the size of the faillog */
if (fstat (fileno (fail), &statbuf) != 0) {
- fprintf (stderr,
- _("%s: Cannot get the size of %s: %s\n"),
- Prog, FAILLOG_FILE, strerrno());
+ fprinte(stderr, _("%s: Cannot get the size of %s"), Prog, FAILLOG_FILE);
exit (E_NOPERM);
}
|| (fflush (fail) != 0)
|| (fsync (fileno (fail)) != 0)
|| (fclose (fail) != 0)) {
- fprintf (stderr,
- _("%s: Failed to write %s: %s\n"),
- Prog, FAILLOG_FILE, strerrno());
+ fprinte(stderr, _("%s: Failed to write %s"), Prog, FAILLOG_FILE);
(void) fclose (fail);
errors = true;
}
#include <unistd.h>
#include "atoi/a2i.h"
-#include "string/strerrno.h"
+#include "io/fprintf.h"
#include "subid.h"
#include "stdlib.h"
bool group = false; // get subuids by default
if (!subid_init(Prog, stderr))
- fprintf(stderr, "subid_init: %s\n", strerrno());
+ fprinte(stderr, "subid_init");
while ((c = getopt(argc, argv, "g")) != EOF) {
switch(c) {
case 'g': group = true; break;
#include "atoi/getnum.h"
#include "attr.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "stdlib.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
#include "subid.h"
uid_t *uids;
if (!subid_init(Prog, stderr))
- fprintf(stderr, "subid_init: %s\n", strerrno());
+ fprinte(stderr, "subid_init");
if (argc < 2) {
usage();
}
#include <string.h>
#include "attr.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "string/strcmp/streq.h"
-#include "string/strerrno.h"
#include "subid.h"
static const char Prog[] = "getsubids";
const char *owner;
if (!subid_init(Prog, stderr))
- fprintf(stderr, "subid_init: %s\n", strerrno());
+ fprinte(stderr, "subid_init");
if (argc < 2)
usage();
owner = argv[1];
/*@-exitarg@*/
#include "exitcodes.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#ifdef SHADOWGRP
#include "string/strcmp/streq.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
-#include "string/strerrno.h"
struct option_flags {
cp = pw_encrypt (pass, salt);
memzero_a(pass);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with salt '%s'"), Prog, salt);
exit (1);
}
#ifdef SHADOWGRP
#include "defines.h"
#include "getdef.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "sssd.h"
#include "prototypes.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(), strerrno());
+ fprinte(stderr, _("%s: cannot open %s"), Prog, gr_dbname());
SYSLOG(LOG_WARN, "cannot open %s: %s", gr_dbname(), strerrno());
fail_exit (E_GRP_UPDATE);
}
#ifdef SHADOWGRP
if (is_shadow_grp) {
if (sgr_open (O_CREAT | O_RDWR) == 0) {
- fprintf (stderr,
- _("%s: cannot open %s: %s\n"),
- Prog, sgr_dbname(), strerrno());
+ fprinte(stderr, _("%s: cannot open %s"), Prog, sgr_dbname());
SYSLOG(LOG_WARN, "cannot open %s: %s", sgr_dbname(), strerrno());
fail_exit (E_GRP_UPDATE);
}
#include "atoi/a2i.h"
#include "defines.h"
-#include "prototypes.h"
-#include "getdef.h"
/*@-exitarg@*/
#include "exitcodes.h"
+#include "getdef.h"
+#include "io/fprintf.h"
+#include "prototypes.h"
#include "shadowlog.h"
#include "sizeof.h"
#include "string/memset/memzero.h"
-#include "string/strerrno.h"
#include "string/strftime.h"
#undef NDEBUG
/* Get the lastlog size */
if (fstat (fileno (lastlogfile), &statbuf) != 0) {
- fprintf (stderr,
- _("%s: Cannot get the size of %s: %s\n"),
- Prog, _PATH_LASTLOG, strerrno());
+ fprinte(stderr, _("%s: Cannot get the size of %s"), Prog, _PATH_LASTLOG);
exit (EXIT_FAILURE);
}
#include "faillog.h"
#include "failure.h"
#include "getdef.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "pwauth.h"
#include "shadow/gshadow/endsgent.h"
#include "string/strcmp/strprefix.h"
#include "string/strcpy/strtcpy.h"
#include "string/strdup/strdup.h"
-#include "string/strerrno.h"
#include "string/strftime.h"
#include "sysconf.h"
child = fork ();
if (child < 0) {
/* error in fork() */
- fprintf(stderr, _("%s: failure forking: %s"), Prog, strerrno());
+ fprinte(stderr, _("%s: failure forking"), Prog);
retcode = pam_close_session(pamh, 0);
pam_end(pamh, retcode);
exit (0);
#include <unistd.h>
#include "atoi/a2i.h"
-#include "string/strerrno.h"
+#include "io/fprintf.h"
#include "subid.h"
#include "stdlib.h"
bool ok;
if (!subid_init(Prog, stderr))
- fprintf(stderr, "subid_init: %s\n", strerrno());
+ fprinte(stderr, "subid_init");
while ((c = getopt(argc, argv, "gn")) != EOF) {
switch(c) {
case 'n': makenew = true; break;
#include "defines.h"
#include "getdef.h"
#include "idmapping.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "string/strcmp/strprefix.h"
-#include "string/strerrno.h"
#include "subordinateio.h"
fprintf(stderr, _("%s: kernel doesn't support setgroups restrictions\n"), Prog);
goto out;
}
- fprintf(stderr, _("%s: couldn't open process setgroups: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: couldn't open process setgroups"), Prog);
exit(EXIT_FAILURE);
}
* fail.
*/
if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) {
- fprintf(stderr, _("%s: failed to read setgroups: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: failed to read setgroups"), Prog);
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, strerrno());
+ fprinte(stderr, _("%s: failed to seek setgroups"), Prog);
exit(EXIT_FAILURE);
}
if (dprintf(setgroups_fd, "%s", policy) < 0) {
- fprintf(stderr, _("%s: failed to setgroups %s policy: %s\n"),
- Prog, policy, strerrno());
+ fprinte(stderr, _("%s: failed to setgroups %s policy"), Prog, policy);
exit(EXIT_FAILURE);
}
/* Get the effective uid and effective gid of the target process */
if (fstat(proc_dir_fd, &st) < 0) {
- fprintf(stderr,
- _("%s: Could not stat directory for target process: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: Could not stat directory for target process"), Prog);
return EXIT_FAILURE;
}
}
if (want_subgid_file() && !sub_gid_open(O_RDONLY)) {
- fprintf (stderr,
- _("%s: cannot open %s: %s\n"),
- Prog, sub_gid_dbname(), strerrno());
+ fprinte(stderr, _("%s: cannot open %s"), Prog, sub_gid_dbname());
return EXIT_FAILURE;
}
/*@-exitarg@*/
#include "exitcodes.h"
#include "getdef.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "search/l/lfind.h"
#include "search/l/lsearch.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
-#include "string/strerrno.h"
#undef NDEBUG
#include <assert.h>
erase_pass (cp);
if (NULL == cpasswd) {
- fprintf (stderr,
- _("%s: failed to crypt password with previous salt: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with previous salt"),
+ Prog);
SYSLOG(LOG_INFO,
"Failed to crypt password with previous salt of group '%s'",
groupname);
child = fork ();
if ((pid_t)-1 == child) {
/* error in fork() */
- fprintf (stderr, _("%s: failure forking: %s\n"),
- is_newgrp ? "newgrp" : "sg", strerrno());
+ fprinte(stderr, _("%s: failure forking"),
+ is_newgrp ? "newgrp" : "sg");
#ifdef WITH_AUDIT
if (group) {
audit_logger_with_group(AUDIT_CHGRP_ID, "changing", NULL,
#include "defines.h"
#include "getdef.h"
#include "idmapping.h"
+#include "io/fprintf.h"
#include "prototypes.h"
#include "shadowlog.h"
#include "string/strcmp/strprefix.h"
-#include "string/strerrno.h"
#include "subordinateio.h"
/* Get the effective uid and effective gid of the target process */
if (fstat(proc_dir_fd, &st) < 0) {
- fprintf(stderr,
- _("%s: Could not stat directory for target process: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: Could not stat directory for target process"), Prog);
return EXIT_FAILURE;
}
}
if (want_subuid_file() && !sub_uid_open(O_RDONLY)) {
- fprintf (stderr,
- _("%s: cannot open %s: %s\n"),
- Prog, sub_uid_dbname(), strerrno());
+ fprinte(stderr, _("%s: cannot open %s"), Prog, sub_uid_dbname());
return EXIT_FAILURE;
}
#include "getdef.h"
#include "groupio.h"
#include "io/fgets/fgets.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#include "pwio.h"
#include "string/sprintf/stprintf.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"
const char *salt = crypt_make_salt (crypt_method, crypt_arg);
cp = pw_encrypt (password, salt);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
return 1;
}
pwd->pw_passwd = cp;
crypt_arg);
cp = pw_encrypt (password, salt);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr,
+ _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
return 1;
}
spent.sp_pwdp = cp;
const char *salt = crypt_make_salt (crypt_method, crypt_arg);
cp = pw_encrypt (password, salt);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr,
+ _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
return 1;
}
spent.sp_pwdp = cp;
usernames = reallocf_T(usernames, nusers, char *);
passwords = reallocf_T(passwords, nusers, char *);
if (lines == NULL || usernames == NULL || passwords == NULL) {
- fprintf(stderr, _("%s: line %jd: %s\n"), Prog, line, strerrno());
+ fprinte(stderr, _("%s: line %jd"), Prog, line);
fail_exit (EXIT_FAILURE, process_selinux);
}
lines[nusers-1] = line;
fail_exit (EXIT_FAILURE, process_selinux);
}
if (mkdir (newpw.pw_dir, mode) != 0) {
- fprintf (stderr,
- _("%s: line %jd: mkdir %s failed: %s\n"),
- Prog, line, newpw.pw_dir, strerrno());
+ fprinte(stderr, _("%s: line %jd: mkdir %s failed"),
+ Prog, line, newpw.pw_dir);
if (errno != EEXIST) {
fail_exit (EXIT_FAILURE, process_selinux);
}
}
if (chown(newpw.pw_dir, newpw.pw_uid, newpw.pw_gid) != 0)
{
- fprintf (stderr,
- _("%s: line %jd: chown %s failed: %s\n"),
- Prog, line, newpw.pw_dir, strerrno());
+ fprinte(stderr, _("%s: line %jd: chown %s failed"),
+ Prog, line, newpw.pw_dir);
fail_exit (EXIT_FAILURE, process_selinux);
}
}
unsigned long sub_uid_count = 0;
if (find_new_sub_uids(newpw.pw_uid, &sub_uid_start, &sub_uid_count) != 0)
{
- fprintf (stderr,
- _("%s: can't find subordinate user range: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: can't find subordinate user range"),
+ Prog);
SYSLOG(LOG_WARN, "can't find subordinate user range: %s\n",
strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
gid_t sub_gid_start = 0;
unsigned long sub_gid_count = 0;
if (find_new_sub_gids(newpw.pw_uid, &sub_gid_start, &sub_gid_count) != 0) {
- fprintf (stderr,
- _("%s: can't find subordinate group range: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: can't find subordinate group range"),
+ Prog);
SYSLOG(LOG_WARN, "can't find subordinate group range: %s\n",
strerrno());
fail_exit (EXIT_FAILURE, process_selinux);
#include "chkname.h"
#include "defines.h"
#include "getdef.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#include "pwauth.h"
#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"
if (NULL == cipher) {
erase_pass (clear);
- fprintf (stderr,
- _("%s: failed to crypt password with previous salt: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with previous salt"),
+ Prog);
SYSLOG(LOG_INFO,
"Failed to crypt password with previous salt of user '%s'",
pw->pw_name);
memzero_a(pass);
if (NULL == cp) {
- fprintf (stderr,
- _("%s: failed to crypt password with salt '%s': %s\n"),
- Prog, salt, strerrno());
+ fprinte(stderr, _("%s: failed to crypt password with salt '%s'"),
+ Prog, salt);
return -1;
}
#include "getdef.h"
#include "groupio.h"
#include "io/fgets/fgets.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#include "pwauth.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
-#include "string/strerrno.h"
#include "string/strtok/stpsep.h"
#include "sysconf.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, strerrno());
+ fprinte(stderr, _("%s: cannot create new defaults file"), Prog);
return -1;
}
if (prefix[0]) {
default_file = aprintf("%s/%s", prefix, USER_DEFAULTS_FILE);
if (default_file == NULL) {
- fprintf(stderr,
- _("%s: cannot create new defaults file: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: cannot create new defaults file"), Prog);
goto err_free_new;
}
}
assert(stprintf_a(buf, "%s-", default_file) != -1);
unlink (buf);
if ((link (default_file, buf) != 0) && (ENOENT != errno)) {
- fprintf (stderr,
- _("%s: Cannot create backup file (%s): %s\n"),
- Prog, buf, strerrno());
+ fprinte(stderr, _("%s: Cannot create backup file (%s)"), Prog, buf);
unlink (new_file);
goto err_free_def;
}
* Rename the new default file to its correct name.
*/
if (rename (new_file, default_file) != 0) {
- fprintf (stderr,
- _("%s: rename: %s: %s\n"),
- Prog, new_file, strerrno());
+ fprinte(stderr, _("%s: rename: %s"), Prog, new_file);
goto err_free_def;
}
#ifdef WITH_AUDIT
fd = open (FAILLOG_FILE, O_RDWR);
if (-1 == fd) {
- fprintf (stderr,
- _("%s: failed to open the faillog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerrno());
+ fprinte(stderr, _("%s: failed to open the faillog file for UID %lu"),
+ Prog, (unsigned long) uid);
SYSLOG(LOG_WARN, "failed to open the faillog file for UID %lu", (unsigned long) uid);
return;
}
if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|| (write_full(fd, &fl, sizeof(fl)) == -1)
|| (fsync (fd) != 0)) {
- fprintf (stderr,
- _("%s: failed to reset the faillog entry of UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerrno());
+ fprinte(stderr, _("%s: failed to reset the faillog entry of UID %lu"),
+ Prog, (unsigned long) uid);
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, strerrno());
+ fprinte(stderr, _("%s: failed to close the faillog file for UID %lu"),
+ Prog, (unsigned long) uid);
SYSLOG(LOG_WARN, "failed to close the faillog file for UID %lu", (unsigned long) uid);
}
}
fd = open(_PATH_LASTLOG, O_RDWR);
if (-1 == fd) {
- fprintf (stderr,
- _("%s: failed to open the lastlog file for UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerrno());
+ fprinte(stderr, _("%s: failed to open the lastlog file for UID %lu"),
+ Prog, (unsigned long) uid);
SYSLOG(LOG_WARN, "failed to open the lastlog file for UID %lu", (unsigned long) uid);
return;
}
if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|| (write_full(fd, &ll, sizeof(ll)) == -1)
|| (fsync (fd) != 0)) {
- fprintf (stderr,
- _("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
- Prog, (unsigned long) uid, strerrno());
+ fprinte(stderr, _("%s: failed to reset the lastlog entry of UID %lu"),
+ Prog, (unsigned long) uid);
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, strerrno());
+ fprinte(stderr, _("%s: failed to close the lastlog file for UID %lu"),
+ Prog, (unsigned long) uid);
SYSLOG(LOG_WARN, "failed to close the lastlog file for UID %lu", (unsigned long) uid);
/* continue */
}
fail_exit(E_HOMEDIR, process_selinux);
}
if (statfs(dirname(btrfs_check), &sfs) == -1) {
- fprintf(stderr, "%s: statfs(dirname(\"%s\")): %s\n",
- Prog, path, strerrno());
+ fprinte(stderr, "%s: statfs(dirname(\"%s\"))",
+ Prog, path);
fail_exit(E_HOMEDIR, process_selinux);
}
free(btrfs_check);
#ifdef ENABLE_SUBIDS
if (is_sub_uid && subuid_count != 0) {
if (find_new_sub_uids(user_id, &sub_uid_start, &subuid_count) < 0) {
- fprintf (stderr,
- _("%s: can't create subordinate user IDs: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: can't create subordinate user IDs"),
+ Prog);
SYSLOG(LOG_WARN, "can't create subordinate user IDs: %s\n",
strerrno());
fail_exit(E_SUB_UID_UPDATE, process_selinux);
}
if (is_sub_gid && subgid_count != 0) {
if (find_new_sub_gids(user_id, &sub_gid_start, &subgid_count) < 0) {
- fprintf (stderr,
- _("%s: can't create subordinate group IDs: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: can't create subordinate group IDs"),
+ Prog);
SYSLOG(LOG_WARN, "can't create subordinate group IDs: %s\n",
strerrno());
fail_exit(E_SUB_GID_UPDATE, process_selinux);
#include "defines.h"
#include "getdef.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "sssd.h"
#include "prototypes.h"
free(mailfile);
return 0;
} else {
- fprintf (stderr,
- _("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerrno());
+ fprinte(stderr, _("%s: warning: can't remove %s"), Prog, mailfile);
SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno());
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER,
if (fflg) {
if (unlink (mailfile) != 0) {
- fprintf (stderr,
- _("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerrno());
+ fprinte(stderr, _("%s: warning: can't remove %s"), Prog, mailfile);
SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno());
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER,
return 0; /* mailbox doesn't exist */
}
if (unlink (mailfile) != 0) {
- fprintf (stderr,
- _("%s: warning: can't remove %s: %s\n"),
- Prog, mailfile, strerrno());
+ fprinte(stderr, _("%s: warning: can't remove %s"), Prog, mailfile);
SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno());
#ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER,
return 1;
}
if (shadowtcb_drop_priv () == SHADOWTCB_FAILURE) {
- fprintf (stderr, _("%s: Cannot drop privileges: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: Cannot drop privileges"), Prog);
shadowtcb_gain_priv ();
free (buf);
return 1;
* We will regain them and remove the user's tcb directory afterwards.
*/
if (remove_tree (buf, false) != 0) {
- fprintf (stderr, _("%s: Cannot remove the content of %s: %s\n"),
- Prog, buf, strerrno());
+ fprinte(stderr, _("%s: Cannot remove the content of %s"), Prog, buf);
shadowtcb_gain_priv ();
free (buf);
return 1;
shadowtcb_gain_priv ();
free (buf);
if (shadowtcb_remove (user_name) == SHADOWTCB_FAILURE) {
- fprintf (stderr, _("%s: Cannot remove tcb files for %s: %s\n"),
- Prog, user_name, strerrno());
+ fprinte(stderr, _("%s: Cannot remove tcb files for %s"), Prog, user_name);
ret = 1;
}
return ret;
#include "faillog.h"
#include "getdef.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#include "pwauth.h"
#include "string/strcmp/streq.h"
#include "string/strcmp/strprefix.h"
#include "string/strdup/strdup.h"
-#include "string/strerrno.h"
#include "string/strspn/stprspn.h"
#include "sysconf.h"
#include "time/day_to_str.h"
entry = malloc_T(1, struct id_range_list_entry);
if (!entry) {
- fprintf (stderr,
- _("%s: failed to allocate memory: %s\n"),
- Prog, strerrno());
+ fprinte(stderr, _("%s: failed to allocate memory"), Prog);
return 0;
}
entry->next = *head;
entry = malloc_T(1, struct id_range_list_entry);
if (entry == NULL) {
- fprintf(stderr, "%s: malloc: %s\n", Prog, strerrno());
+ fprinte(stderr, "%s: malloc", Prog);
return 0;
}
fd = open(_PATH_LASTLOG, O_RDWR);
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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the lastlog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
return;
}
if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid)
|| (write_full(fd, &ll, sizeof(ll)) == -1)
|| (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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the lastlog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
}
} else {
/* Assume lseek or read failed because there is
if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid)
|| (write_full(fd, &ll, sizeof(ll)) == -1)
|| (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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the lastlog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
}
}
}
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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the lastlog entry of user %ju to user %ju"),
+ Prog, (uintmax_t) user_id, (uintmax_t) user_newid);
}
}
#endif /* ENABLE_LASTLOG */
fd = open (FAILLOG_FILE, O_RDWR);
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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the faillog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
return;
}
if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid)
|| (write_full(fd, &fl, sizeof(fl)) == -1)
|| (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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the faillog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
}
} else {
/* Assume lseek or read failed because there is
if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid)
|| (write_full(fd, &fl, sizeof(fl)) == -1))
{
- 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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the faillog entry of user %lu to user %lu"),
+ Prog, (unsigned long) user_id, (unsigned long) user_newid);
}
}
}
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, strerrno());
+ fprinte(stderr, _("%s: failed to copy the faillog entry of user %ju to user %ju"),
+ Prog, (uintmax_t) user_id, (uintmax_t) user_newid);
}
}
#ifdef ENABLE_SUBIDS
if (Sflg) {
if (find_range (&add_sub_uids, user_id, find_new_sub_uids) == 0) {
- fprintf (stderr,
- _("%s: unable to find new subordinate uid range: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: unable to find new subordinate uid range"),
+ Prog);
SYSLOG(LOG_WARN, "unable to find new subordinate uid range: %s\n",
strerrno());
fail_exit (E_SUB_UID_UPDATE, process_selinux);
}
if (find_range (&add_sub_gids, user_id, find_new_sub_gids) == 0) {
- fprintf (stderr,
- _("%s: unable to find new subordinate gid range: %s\n"),
- Prog, strerrno());
+ fprinte(stderr,
+ _("%s: unable to find new subordinate gid range"),
+ Prog);
SYSLOG(LOG_WARN, "unable to find new subordinate gid range: %s\n",
strerrno());
fail_exit (E_SUB_GID_UPDATE, process_selinux);
#include "defines.h"
#include "getdef.h"
#include "groupio.h"
+#include "io/fprintf.h"
#include "nscd.h"
#include "prototypes.h"
#include "pwio.h"
#include "string/sprintf/aprintf.h"
#include "string/sprintf/stprintf.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, strerrno());
+ fprinte(stderr, "%s: %s", Prog, editor);
exit (1);
} else if ( WIFEXITED (status)
&& (WEXITSTATUS (status) != 0)) {
if (orig_pgrp != -1) {
editor_pgrp = tcgetpgrp(STDIN_FILENO);
if (editor_pgrp == -1) {
- fprintf (stderr, "%s: %s: %s", Prog,
- "tcgetpgrp", strerrno());
+ fprinte(stderr, "%s: %s", Prog, "tcgetpgrp");
}
if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) {
- fprintf (stderr, "%s: %s: %s", Prog,
- "tcsetpgrp", strerrno());
+ fprinte(stderr, "%s: %s", Prog, "tcsetpgrp");
}
}
kill (getpid (), SIGSTOP);
/* wake child when resumed */
if (editor_pgrp != -1) {
if (tcsetpgrp(STDIN_FILENO, editor_pgrp) == -1) {
- fprintf (stderr, "%s: %s: %s", Prog,
- "tcsetpgrp", strerrno());
+ fprinte(stderr, "%s: %s", Prog, "tcsetpgrp");
}
}
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", strerrno());
+ fprinte(stderr, "%s: %s", Prog, "tcsetpgrp");
}
sigprocmask(SIG_SETMASK, &omask, NULL);
}
unlink (filebackup);
link (file, filebackup);
if (rename (to_rename, file) == -1) {
- fprintf (stderr,
- _("%s: can't restore %s: %s (your changes are in %s)\n"),
- Prog, file, strerrno(), to_rename);
+ fprinte(stderr, _("%s: can't restore %s (your changes are in %s)"),
+ Prog, file, to_rename);
#ifdef WITH_TCB
if (tcb_mode) {
free(to_rename);