better error messages
This commit is contained in:
parent
0fb81f5c39
commit
0edb6a86fb
1
NEWS
1
NEWS
@ -1,6 +1,7 @@
|
|||||||
procps-3.2.4 --> procps-3.2.5
|
procps-3.2.4 --> procps-3.2.5
|
||||||
|
|
||||||
display problem on 64-bit systems fixed
|
display problem on 64-bit systems fixed
|
||||||
|
sysctl: better error messages
|
||||||
ps: security labels can contain any printable ASCII
|
ps: security labels can contain any printable ASCII
|
||||||
top: help and version message on stdout, with exit(0) #283541
|
top: help and version message on stdout, with exit(0) #283541
|
||||||
ps: SIGTSTP from ^Z shouldn't print bug email address
|
ps: SIGTSTP from ^Z shouldn't print bug email address
|
||||||
|
26
sysctl.c
26
sysctl.c
@ -52,15 +52,15 @@ static bool IgnoreError;
|
|||||||
static bool Quiet;
|
static bool Quiet;
|
||||||
|
|
||||||
/* error messages */
|
/* error messages */
|
||||||
static const char ERR_UNKNOWN_PARAMETER[] = "error: Unknown parameter '%s'\n";
|
static const char ERR_UNKNOWN_PARAMETER[] = "error: Unknown parameter \"%s\"\n";
|
||||||
static const char ERR_MALFORMED_SETTING[] = "error: Malformed setting '%s'\n";
|
static const char ERR_MALFORMED_SETTING[] = "error: Malformed setting \"%s\"\n";
|
||||||
static const char ERR_NO_EQUALS[] = "error: '%s' must be of the form name=value\n";
|
static const char ERR_NO_EQUALS[] = "error: \"%s\" must be of the form name=value\n";
|
||||||
static const char ERR_INVALID_KEY[] = "error: '%s' is an unknown key\n";
|
static const char ERR_INVALID_KEY[] = "error: \"%s\" is an unknown key\n";
|
||||||
static const char ERR_UNKNOWN_WRITING[] = "error: unknown error %d setting key '%s'\n";
|
static const char ERR_UNKNOWN_WRITING[] = "error: \"%s\" setting key \"%s\"\n";
|
||||||
static const char ERR_UNKNOWN_READING[] = "error: unknown error %d reading key '%s'\n";
|
static const char ERR_UNKNOWN_READING[] = "error: \"%s\" reading key \"%s\"\n";
|
||||||
static const char ERR_PERMISSION_DENIED[] = "error: permission denied on key '%s'\n";
|
static const char ERR_PERMISSION_DENIED[] = "error: permission denied on key '%s'\n";
|
||||||
static const char ERR_OPENING_DIR[] = "error: unable to open directory '%s'\n";
|
static const char ERR_OPENING_DIR[] = "error: unable to open directory \"%s\"\n";
|
||||||
static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file '%s'\n";
|
static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file \"%s\"\n";
|
||||||
static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n";
|
static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n";
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ static int ReadSetting(const char *restrict const name) {
|
|||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, ERR_UNKNOWN_READING, errno, outname);
|
fprintf(stderr, ERR_UNKNOWN_READING, strerror(errno), outname);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ static int ReadSetting(const char *restrict const name) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, ERR_UNKNOWN_READING, errno, outname);
|
fprintf(stderr, ERR_UNKNOWN_READING, strerror(errno), outname);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -314,19 +314,19 @@ static int WriteSetting(const char *setting) {
|
|||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, ERR_UNKNOWN_WRITING, errno, outname);
|
fprintf(stderr, ERR_UNKNOWN_WRITING, strerror(errno), outname);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rc = fprintf(fp, "%s\n", value);
|
rc = fprintf(fp, "%s\n", value);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
fprintf(stderr, ERR_UNKNOWN_WRITING, errno, outname);
|
fprintf(stderr, ERR_UNKNOWN_WRITING, strerror(errno), outname);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else {
|
} else {
|
||||||
rc=fclose(fp);
|
rc=fclose(fp);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
fprintf(stderr, ERR_UNKNOWN_WRITING, errno, outname);
|
fprintf(stderr, ERR_UNKNOWN_WRITING, strerror(errno), outname);
|
||||||
}
|
}
|
||||||
if (rc==0 && !Quiet) {
|
if (rc==0 && !Quiet) {
|
||||||
if (NameOnly) {
|
if (NameOnly) {
|
||||||
|
Loading…
Reference in New Issue
Block a user