-/* $OpenBSD: look.c,v 1.21 2017/01/21 10:03:27 krw Exp $ */
+/* $OpenBSD: look.c,v 1.22 2018/08/11 11:00:34 mestre Exp $ */
/* $NetBSD: look.c,v 1.7 1995/08/31 22:41:02 jtc Exp $ */
/*-
int ch, fd, termchar;
char *back, *file, *front, *string, *p;
- if (pledge("stdio rpath", NULL) == -1)
- err(1, "pledge");
-
file = _PATH_WORDS;
termchar = '\0';
while ((ch = getopt(argc, argv, "dft:")) != -1)
usage();
}
+ if (unveil(file, "r") == -1)
+ err(2, "unveil");
+ if (pledge("stdio rpath", NULL) == -1)
+ err(2, "pledge");
+
if (termchar != '\0' && (p = strchr(string, termchar)) != NULL)
*++p = '\0';