logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 1ddfde2bc7463991444614e7668a20f48ac3492d
parent 4ee7e06a57c9f47242d27ca3284c34389b7bd09a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 19 Sep 2024 18:51:14 +0200

cmd/chroot: unify error message formatting

Diffstat:

Mcmd/chroot.c10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/chroot.c b/cmd/chroot.c @@ -18,20 +18,20 @@ main(int argc, char *argv[]) { if(argc < 2) { - fprintf(stderr, "chroot: Needs arguments\n"); + fprintf(stderr, "chroot: error: Needs arguments\n"); fprintf(stderr, "Usage: chroot <newroot> [command [args ...]]\n"); return 125; } if(chroot(argv[1]) < 0) { - perror("chroot"); + perror("chroot: error: Failed to chroot"); return 125; } if(chdir("/") < 0) { - perror("chroot: chdir"); + perror("chroot: error: Failed to change directory"); return 125; } @@ -44,7 +44,7 @@ main(int argc, char *argv[]) if(strnlen(shell, PATH_MAX) >= PATH_MAX) { fprintf(stderr, - "chroot: Warning: $SHELL is longer than {PATH_MAX}(= %d), using '/bin/sh'\n", + "chroot: warning: $SHELL is longer than {PATH_MAX}(= %d), using '/bin/sh'\n", PATH_MAX); shell = "/bin/sh"; } @@ -59,7 +59,7 @@ main(int argc, char *argv[]) if(ret != 0) { - perror("chroot: exec"); + perror("chroot: error: Execution failed"); if(errno == ENOENT) return 127; return 126;