fix error exit codes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18707 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -39,7 +39,7 @@ openDevice(const char *name)
|
|||||||
|
|
||||||
int device = open(name, O_RDONLY);
|
int device = open(name, O_RDONLY);
|
||||||
if (device < 0)
|
if (device < 0)
|
||||||
fprintf(stderr, "%s: could not open \"%s\": %s\n", gProgramName, name, strerror(device));
|
fprintf(stderr, "%s: could not open \"%s\": %s\n", gProgramName, name, strerror(errno));
|
||||||
else {
|
else {
|
||||||
uint32 version;
|
uint32 version;
|
||||||
if (ioctl(device, BFS_IOCTL_VERSION, &version) < B_OK) {
|
if (ioctl(device, BFS_IOCTL_VERSION, &version) < B_OK) {
|
||||||
@@ -119,7 +119,7 @@ main(int argc, char **argv)
|
|||||||
if (argc < 2 || !strcmp(argv[1], "--help"))
|
if (argc < 2 || !strcmp(argv[1], "--help"))
|
||||||
{
|
{
|
||||||
printUsage();
|
printUsage();
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
control.magic = BFS_IOCTL_CHECK_MAGIC;
|
control.magic = BFS_IOCTL_CHECK_MAGIC;
|
||||||
@@ -152,13 +152,13 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
int device = openDevice(argv[0]);
|
int device = openDevice(argv[0]);
|
||||||
if (device < 0)
|
if (device < 0)
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
// start checking
|
// start checking
|
||||||
|
|
||||||
if (startChecking(device, control) < B_OK) {
|
if (startChecking(device, control) < B_OK) {
|
||||||
close(device);
|
close(device);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset all counters
|
// reset all counters
|
||||||
@@ -208,7 +208,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (stopChecking(device, control) < B_OK) {
|
if (stopChecking(device, control) < B_OK) {
|
||||||
close(device);
|
close(device);
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print stats
|
// print stats
|
||||||
|
|||||||
+2
-2
@@ -143,7 +143,7 @@ main(int argc, char **argv)
|
|||||||
if (device < 0) {
|
if (device < 0) {
|
||||||
fprintf(stderr, "%s: could not find device: %s\n", __progname,
|
fprintf(stderr, "%s: could not find device: %s\n", __progname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
mode = kFilterDevice;
|
mode = kFilterDevice;
|
||||||
if (argv[1][1] == 'D')
|
if (argv[1][1] == 'D')
|
||||||
@@ -154,7 +154,7 @@ main(int argc, char **argv)
|
|||||||
if (::stat(argv[2], &stat) < 0) {
|
if (::stat(argv[2], &stat) < 0) {
|
||||||
fprintf(stderr, "%s: could not open file: %s\n", __progname,
|
fprintf(stderr, "%s: could not open file: %s\n", __progname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return -1;
|
return 1;
|
||||||
}
|
}
|
||||||
device = stat.st_dev;
|
device = stat.st_dev;
|
||||||
node = stat.st_ino;
|
node = stat.st_ino;
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ usage()
|
|||||||
"\t'attr' is the name of an attribute of the file\n"
|
"\t'attr' is the name of an attribute of the file\n"
|
||||||
"\tIf '-p' is specified, 'attr' is regarded as a pattern.\n", kProgramName);
|
"\tIf '-p' is specified, 'attr' is regarded as a pattern.\n", kProgramName);
|
||||||
|
|
||||||
exit(0);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ main(int32 argc, const char **argv)
|
|||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "%s: can\'t open file %s to remove attribute: %s\n",
|
fprintf(stderr, "%s: can\'t open file %s to remove attribute: %s\n",
|
||||||
kProgramName, argv[i], strerror(errno));
|
kProgramName, argv[i], strerror(errno));
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remove_attribute(fd, argv[attr], isPattern) != B_OK) {
|
if (remove_attribute(fd, argv[attr], isPattern) != B_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user