-/* $OpenBSD: from.c,v 1.25 2017/05/31 19:41:30 millert Exp $ */
+/* $OpenBSD: from.c,v 1.26 2018/08/08 17:52:46 deraadt Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
}
argv += optind;
- if (pledge("stdio rpath getpw", NULL) == -1)
+ if (pledge("stdio unveil rpath getpw", NULL) == -1)
err(1, "pledge");
file = mail_spool(file, *argv);
+
+ if (unveil(file, "r") == -1)
+ err(1, "unveil");
+ if (pledge("stdio rpath getpw", NULL) == -1)
+ err(1, "pledge");
+
if ((fp = fopen(file, "r")) == NULL) {
if (!fflag && errno == ENOENT)
exit(EXIT_SUCCESS);