diff options
author | Alan Brault <alan.brault@incruentatus.net> | 2011-05-03 09:50:15 -0400 |
---|---|---|
committer | Alan Brault <alan.brault@incruentatus.net> | 2011-05-03 09:50:15 -0400 |
commit | 4957bf13b26a403271c9838a9b74b9f61682fa8e (patch) | |
tree | 942d28cad437dd20bf29cb60ad58ad4949b87c96 | |
parent | b608b55786a8cecf626d7c489496ac402098b198 (diff) | |
download | duser-4957bf13b26a403271c9838a9b74b9f61682fa8e.tar.gz |
Remove config.h from strchrnul.c; not needed
Fix numerous shadow declaration bugs that could cause problems for Solaris libc
Fix bad prototype using in unlink()
-rw-r--r-- | compat/strchrnul.c | 1 | ||||
-rw-r--r-- | include/cfg.h | 2 | ||||
-rw-r--r-- | include/duser.h | 7 | ||||
-rw-r--r-- | include/version.h | 2 | ||||
-rw-r--r-- | src/log.c | 2 | ||||
-rw-r--r-- | src/user.c | 21 |
6 files changed, 19 insertions, 16 deletions
diff --git a/compat/strchrnul.c b/compat/strchrnul.c index 4781281..da8898b 100644 --- a/compat/strchrnul.c +++ b/compat/strchrnul.c @@ -18,7 +18,6 @@ * along with duser. If not, see <http://www.gnu.org/licenses/>. **/ -#include <config.h> #include <string.h> #include "strchrnul.h" diff --git a/include/cfg.h b/include/cfg.h index d3814f3..b50c16b 100644 --- a/include/cfg.h +++ b/include/cfg.h @@ -23,7 +23,7 @@ #define CFG_MAX 255 int cfg_open(const char* filename); -void cfg_close(); +void cfg_close(void); int cfg_get_key(char* val, const char* key); #endif diff --git a/include/duser.h b/include/duser.h index e955252..345bf49 100644 --- a/include/duser.h +++ b/include/duser.h @@ -58,11 +58,11 @@ typedef struct record_t int pad3; } record_t; -void usage(); +void usage(void); int strval(const char* str); int strfind(const char* str1, const char* str2); -int logcleanup(); -int COM(const char* func, char *format, ...); +int logcleanup(void); +int COM(const char* func, const char *format, ...); record_t* find_in_file(const char* filename, const char* needle); int get_file_count(const char* path); char** get_file_list(const char* path, int count); @@ -77,4 +77,5 @@ int user_cmd(const int argc, char* argv[]); int user_choice(char c); int user_add(const char* filename, const char* needle); int user_new_list(const char* fname); +int check_cmd_string(char** args, const char* str2, int count); #endif diff --git a/include/version.h b/include/version.h index 52763c1..ddbf2b7 100644 --- a/include/version.h +++ b/include/version.h @@ -5,5 +5,5 @@ #define VER_MINOR "0" #define VER_OTH " " -void version(); +void version(void); #endif @@ -43,7 +43,7 @@ int logcleanup() return status; } -int COM(const char* func, char *format, ...) +int COM(const char* func, const char *format, ...) { struct tm *logtm; time_t logtime = time(NULL); @@ -159,16 +159,16 @@ int user_del(record_t* rec) int bytes = 0; int bytes_total = 0; char buf[REGEX_MAX]; - char tmpfile[255]; - snprintf(tmpfile, sizeof(tmpfile), "/tmp/duser.%s.XXXXXX", basename(rec->file)); - if((fd = mkstemp(tmpfile)) < 0 || (tfp = fdopen(fd, "r+")) == NULL) + char _tmpfile[255]; + snprintf(_tmpfile, sizeof(_tmpfile), "/tmp/duser.%s.XXXXXX", basename(rec->file)); + if((fd = mkstemp(_tmpfile)) < 0 || (tfp = fdopen(fd, "r+")) == NULL) { if(fd != -1) { close(fd); - unlink(tmpfile); + unlink(_tmpfile); } - fprintf(stderr, "FATAL: %s: %s: %s\n", SELF, tmpfile, strerror(errno)); + fprintf(stderr, "FATAL: %s: %s: %s\n", SELF, _tmpfile, strerror(errno)); exit(1); } @@ -220,7 +220,10 @@ int user_del(record_t* rec) fclose(fp); close(fd); - unlink(tmpfile); + + /* unistd.h requires this be a (const char *) not (struct FILE * (*)(void)) */ + /* -- extrarius -- */ + unlink((const char *)tmpfile); if(bytes_total) return bytes_total; @@ -266,7 +269,7 @@ record_t* find_in_file(const char* filename, const char* needle) rptr->index = 0; rptr->match = 0; - int index = 0; + int _index = 0; FILE *fp; char *fname = strdup(filename); @@ -287,9 +290,9 @@ record_t* find_in_file(const char* filename, const char* needle) { snprintf(rptr->name, REGEX_MAX, "%s", cmp); rptr->match = 1; - rptr->index = index; + rptr->index = _index; } - index++; + _index++; processed.lines++; } |