Imported Upstream version 1.8.7
[debian/sudo] / plugins / sudoers / regress / iolog_path / check_iolog_path.c
index cef22ffabde19f9e0df8fd0a9b0823ca0d5599bf..f3c07622e55d8155dd39c6260de5bbaad0e3ade5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2011-2013 Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
 #ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif /* HAVE_STRINGS_H */
-#ifdef HAVE_SETLOCALE
-# include <locale.h>
-#endif
 #include <pwd.h>
 #include <grp.h>
 #include <time.h>
 
+#define SUDO_ERROR_WRAP 0
+
 #define _SUDO_MAIN
 #include "sudoers.h"
 #include "def_data.c"
@@ -51,6 +50,8 @@ struct passwd *list_pw;
 
 static char sessid[7];
 
+__dso_public int main(int argc, char *argv[]);
+
 static void
 usage(void)
 {
@@ -105,12 +106,16 @@ main(int argc, char *argv[])
     int errors = 0;
     int tests = 0;
 
+#if !defined(HAVE_GETPROGNAME) && !defined(HAVE___PROGNAME)
+    setprogname(argc > 0 ? argv[0] : "check_iolog_path");
+#endif
+
     if (argc != 2)
        usage();
 
     fp = fopen(argv[1], "r");
     if (fp == NULL)
-       errorx(1, "unable to open %s", argv[1]);
+       fatalx("unable to open %s", argv[1]);
 
     memset(&pw, 0, sizeof(pw));
     memset(&rpw, 0, sizeof(rpw));
@@ -179,7 +184,7 @@ main(int argc, char *argv[])
            tests++;
            break;
        default:
-           errorx(1, "internal error, invalid state %d", state);
+           fatalx("internal error, invalid state %d", state);
        }
        state = (state + 1) % MAX_STATE;
     }
@@ -193,13 +198,7 @@ main(int argc, char *argv[])
     exit(errors);
 }
 
-void io_nextid(char *iolog_dir, char id[7])
+void io_nextid(char *iolog_dir, char *fallback, char id[7])
 {
     memcpy(id, sessid, sizeof(sessid));
 }
-
-void
-cleanup(int gotsig)
-{
-    return;
-}