-/* $OpenBSD: nice.c,v 1.14 2014/02/13 20:51:10 tedu Exp $ */
+/* $OpenBSD: nice.c,v 1.15 2015/10/19 18:53:35 deraadt Exp $ */
/* $NetBSD: nice.c,v 1.9 1995/08/31 23:30:58 jtc Exp $ */
/*
setlocale(LC_ALL, "");
+ if (pledge("stdio exec proc", NULL) == -1)
+ err(1, "pledge");
+
/* handle obsolete -number syntax */
if (argc > 1 && argv[1][0] == '-' &&
isdigit((unsigned char)argv[1][1])) {
if (errstr)
errx(1, "increment is %s", errstr);
break;
- case '?':
default:
usage();
break;
errno = 0;
prio += getpriority(PRIO_PROCESS, 0);
- if (errno) {
+ if (errno)
err(1, "getpriority");
- /* NOTREACHED */
- }
if (setpriority(PRIO_PROCESS, 0, prio))
warn("setpriority");
+ if (pledge("stdio exec", NULL) == -1)
+ err(1, "pledge");
+
execvp(argv[0], &argv[0]);
err((errno == ENOENT) ? 127 : 126, "%s", argv[0]);
- /* NOTREACHED */
}
static void