From 2682ef6b4bb67161e3b09a80ead06667cbfbeb11 Mon Sep 17 00:00:00 2001 From: deraadt Date: Thu, 22 Oct 2015 04:08:17 +0000 Subject: [PATCH] Until we understand the sitaution better, we should pledge() after setlocale(), not before. Not just here, but probably everywhere? --- usr.bin/awk/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 6252251001f..82996bc6f71 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.18 2015/10/10 20:04:28 doug Exp $ */ +/* $OpenBSD: main.c,v 1.19 2015/10/22 04:08:17 deraadt Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -61,14 +61,15 @@ int main(int argc, char *argv[]) { const char *fs = NULL; + setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ + if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) { fprintf(stderr, "%s: pledge: incorrect arguments\n", cmdname); exit(1); } - setlocale(LC_ALL, ""); - setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = __progname; if (argc == 1) { fprintf(stderr, "usage: %s [-safe] [-V] [-d[n]] [-F fs] " -- 2.20.1