aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@openbsd.org>2015-07-18 18:44:26 +0000
committerTed Unangst <tedu@openbsd.org>2015-07-18 18:44:26 +0000
commit4d4f6fa0c5427100849b2bbfe95aa93d7fbf8b87 (patch)
treeb90e42cc100db9649acf00206760c0bdc6d6024a
parent5f718aab97c65070596dd1223a8b86b151f57a34 (diff)
downloadopendoas-4d4f6fa0c5427100849b2bbfe95aa93d7fbf8b87.tar.gz
rearrange variable decls a little
-rw-r--r--doas.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/doas.c b/doas.c
index 02cc4b2..ac15f50 100644
--- a/doas.c
+++ b/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.7 2015/07/18 00:19:38 doug Exp $ */
+/* $OpenBSD: doas.c,v 1.8 2015/07/18 06:33:23 nicm Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -43,6 +43,7 @@ size_t
arraylen(const char **arr)
{
size_t cnt = 0;
+
while (*arr) {
cnt++;
arr++;
@@ -165,6 +166,7 @@ copyenvhelper(const char **oldenvp, const char **safeset, int nsafe,
char **envp, int ei)
{
int i;
+
for (i = 0; i < nsafe; i++) {
const char **oe = oldenvp;
while (*oe) {
@@ -189,12 +191,12 @@ copyenv(const char **oldenvp, struct rule *rule)
"PATH", "TERM", "USER", "USERNAME",
NULL,
};
- int nsafe;
- int nextras = 0;
char **envp;
const char **extra;
int ei;
int i, j;
+ int nsafe;
+ int nextras = 0;
if ((rule->options & KEEPENV) && !rule->envlist) {
j = arraylen(oldenvp);
@@ -244,20 +246,21 @@ fail(void)
int
main(int argc, char **argv, char **envp)
{
+ const char *safepath = "/bin:/sbin:/usr/bin:/usr/sbin:"
+ "/usr/local/bin:/usr/local/sbin";
+ char *shargv[] = { NULL, NULL };
+ char *sh;
+ const char *cmd;
char cmdline[LINE_MAX];
char myname[_PW_NAME_LEN + 1];
- uid_t uid, target = 0;
- gid_t groups[NGROUPS_MAX + 1];
- int ngroups;
struct passwd *pw;
struct rule *rule;
- const char *cmd;
+ uid_t uid;
+ uid_t target = 0;
+ gid_t groups[NGROUPS_MAX + 1];
+ int ngroups;
int i, ch;
- const char *safepath = "/bin:/sbin:/usr/bin:/usr/sbin:"
- "/usr/local/bin:/usr/local/sbin";
int sflag = 0;
- char *shargv[] = { NULL, NULL };
- char *sh;
parseconfig("/etc/doas.conf");