Stop using EXIT_{SUCCESS,FAILURE}
This commit is contained in:
14
util/cp.c
14
util/cp.c
@@ -22,7 +22,7 @@ bool cp_fflag = false;
|
||||
bool cp_pflag = false;
|
||||
bool cp_rflag = false;
|
||||
bool cp_vflag = false;
|
||||
int cp_status = EXIT_SUCCESS;
|
||||
int cp_status = 0;
|
||||
|
||||
int
|
||||
cp(const char *s1, const char *s2)
|
||||
@@ -52,7 +52,7 @@ cp(const char *s1, const char *s2)
|
||||
unlink(s2);
|
||||
if(symlink(buf, s2) != 0) {
|
||||
weprintf("%s: can't create '%s'\n", argv0, s2);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ cp(const char *s1, const char *s2)
|
||||
unlink(s2);
|
||||
if(mknod(s2, st.st_mode, st.st_rdev) < 0) {
|
||||
weprintf("%s: can't create '%s':", argv0, s2);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
return 0;
|
||||
}
|
||||
goto preserve;
|
||||
@@ -107,7 +107,7 @@ cp(const char *s1, const char *s2)
|
||||
|
||||
if(!(f1 = fopen(s1, "r"))) {
|
||||
weprintf("fopen %s:", s1);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -116,12 +116,12 @@ cp(const char *s1, const char *s2)
|
||||
unlink(s2);
|
||||
if(!(f2 = fopen(s2, "w"))) {
|
||||
weprintf("fopen %s:", s2);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
weprintf("fopen %s:", s2);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ preserve:
|
||||
r = chown(s2, st.st_uid, st.st_gid);
|
||||
if(r == -1) {
|
||||
weprintf("cp: can't preserve ownership of '%s':", s2);
|
||||
cp_status = EXIT_FAILURE;
|
||||
cp_status = 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
14
util/crypt.c
14
util/crypt.c
@@ -42,7 +42,7 @@ cryptcheck(char *sumfile, int argc, char *argv[],
|
||||
{
|
||||
FILE *cfp, *fp;
|
||||
char *line = NULL, *file, *p;
|
||||
int r, nonmatch = 0, formatsucks = 0, noread = 0, ret = EXIT_SUCCESS;
|
||||
int r, nonmatch = 0, formatsucks = 0, noread = 0, ret = 0;
|
||||
size_t bufsiz = 0;
|
||||
|
||||
if(sumfile == NULL)
|
||||
@@ -85,15 +85,15 @@ cryptcheck(char *sumfile, int argc, char *argv[],
|
||||
free(line);
|
||||
if(formatsucks > 0) {
|
||||
weprintf("%d lines are improperly formatted\n", formatsucks);
|
||||
ret = EXIT_FAILURE;
|
||||
ret = 1;
|
||||
}
|
||||
if(noread > 0) {
|
||||
weprintf("%d listed file could not be read\n", noread);
|
||||
ret = EXIT_FAILURE;
|
||||
ret = 1;
|
||||
}
|
||||
if(nonmatch > 0) {
|
||||
weprintf("%d computed checksums did NOT match\n", nonmatch);
|
||||
ret = EXIT_FAILURE;
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ cryptmain(int argc, char *argv[],
|
||||
struct crypt_ops *ops, uint8_t *md, size_t sz)
|
||||
{
|
||||
FILE *fp;
|
||||
int ret = EXIT_SUCCESS;
|
||||
int ret = 0;
|
||||
|
||||
if (argc == 0) {
|
||||
cryptsum(ops, stdin, "<stdin>", md);
|
||||
@@ -112,11 +112,11 @@ cryptmain(int argc, char *argv[],
|
||||
for (; argc > 0; argc--) {
|
||||
if((fp = fopen(*argv, "r")) == NULL) {
|
||||
weprintf("fopen %s:", *argv);
|
||||
ret = EXIT_FAILURE;
|
||||
ret = 1;
|
||||
continue;
|
||||
}
|
||||
if(cryptsum(ops, fp, *argv, md) == 1)
|
||||
ret = EXIT_FAILURE;
|
||||
ret = 1;
|
||||
else
|
||||
mdprint(md, *argv, sz);
|
||||
fclose(fp);
|
||||
|
@@ -16,7 +16,7 @@ eprintf(const char *fmt, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
venprintf(EXIT_FAILURE, fmt, ap);
|
||||
venprintf(1, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user