usr.sbin/uefisign: prevent specifying certificate, key or output
multiple times. MFC after: 1 month
This commit is contained in:
parent
d22883d715
commit
6234a0bfc8
@ -350,13 +350,22 @@ main(int argc, char **argv)
|
|||||||
Vflag = true;
|
Vflag = true;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
certpath = checked_strdup(optarg);
|
if (certpath == NULL)
|
||||||
|
certpath = checked_strdup(optarg);
|
||||||
|
else
|
||||||
|
err(1, "-c can only be specified once");
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
keypath = checked_strdup(optarg);
|
if (keypath == NULL)
|
||||||
|
keypath = checked_strdup(optarg);
|
||||||
|
else
|
||||||
|
err(1, "-k can only be specified once");
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
outpath = checked_strdup(optarg);
|
if (outpath == NULL)
|
||||||
|
outpath = checked_strdup(optarg);
|
||||||
|
else
|
||||||
|
err(1, "-o can only be specified once");
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
vflag = true;
|
vflag = true;
|
||||||
@ -402,7 +411,7 @@ main(int argc, char **argv)
|
|||||||
err(1, "fork");
|
err(1, "fork");
|
||||||
|
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
return (child(inpath, outpath, pipefds[1], Vflag, vflag));
|
exit(child(inpath, outpath, pipefds[1], Vflag, vflag));
|
||||||
|
|
||||||
if (!Vflag) {
|
if (!Vflag) {
|
||||||
certfp = checked_fopen(certpath, "r");
|
certfp = checked_fopen(certpath, "r");
|
||||||
@ -422,5 +431,5 @@ main(int argc, char **argv)
|
|||||||
sign(cert, key, pipefds[0]);
|
sign(cert, key, pipefds[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (wait_for_child(pid));
|
exit(wait_for_child(pid));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user