=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/dc/dc.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- src/usr.bin/dc/dc.c 2016/07/17 17:30:47 1.18 +++ src/usr.bin/dc/dc.c 2017/11/29 14:34:17 1.19 @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.18 2016/07/17 17:30:47 otto Exp $ */ +/* $OpenBSD: dc.c,v 1.19 2017/11/29 14:34:17 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek @@ -72,6 +72,11 @@ argc -= optind; argv += optind; + if (argc == 0) { + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); + } + init_bmachine(extended_regs); (void)setvbuf(stdout, NULL, _IOLBF, 0); (void)setvbuf(stderr, NULL, _IOLBF, 0); @@ -108,9 +113,6 @@ */ return (0); } - - if (pledge("stdio", NULL) == -1) - err(1, "pledge"); src_setstream(&src, stdin); reset_bmachine(&src);