Nmap Development mailing list archives
[PATCH] Remove envp[] from main()
From: Kris Katterjohn <kjak () ispwest com>
Date: Wed, 23 Aug 2006 13:50:56 -0500
Removing envp[] from main() adds portability (ISO C says only two arguments for main(), and POSIX says getenv(), environ, etc. can do anything envp[] could). I've compiled and run it with the patch and it runs fine. The patch is a diff against 4.20ALPHA4 Thanks, Kris Katterjohn
--- x/main.cc 2006-03-05 15:31:20.000000000 -0600 +++ y/main.cc 2006-08-23 13:43:45.000000000 -0500 @@ -138,7 +138,7 @@ static BOOL OpenLibs(void) { extern NmapOps o; /* option structure */ extern char **environ; -int main(int argc, char *argv[], char *envp[]) { +int main(int argc, char *argv[]) { /* The "real" main is nmap_main(). This function hijacks control at the beginning to do the following: 1) Check if Nmap called under name listed in INTERACTIVE_NAMES or with @@ -314,7 +314,6 @@ int main(int argc, char *argv[], char *e } else fatal("Arguments too long."); } } - /* First we stick our arguments into envp */ if (o.debugging) { error("Adding to environment: %s", nmapargs); }
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [PATCH] Remove envp[] from main() Kris Katterjohn (Aug 23)