-/* $OpenBSD: fstat.c,v 1.81 2015/10/10 14:29:05 deraadt Exp $ */
+/* $OpenBSD: fstat.c,v 1.82 2015/10/12 14:09:32 deraadt Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
if ((kf = kvm_getfiles(kd, what, arg, sizeof(*kf), &cnt)) == NULL)
errx(1, "%s", kvm_geterr(kd));
- if (pledge("stdio rpath route", NULL) == -1)
- err(1, "pledge");
+ if (fuser) {
+ if (sflg) { /* fuser might call kill(2) */
+ if (pledge("stdio rpath proc", NULL) == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
+ }
+ } else {
+ if (pledge("stdio rpath route", NULL) == -1)
+ err(1, "pledge");
+ }
find_splices(kf, cnt);
if (!fuser)