aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunk@stsci.edu>2011-04-05 15:53:11 -0400
committerJoseph Hunkeler <jhunk@stsci.edu>2011-04-05 15:53:11 -0400
commit9caebb1675517798570aea81a831ca2ec1f23153 (patch)
tree6469bedc18b53aaf445cec6836f23ee3d8376ed0 /log.c
parenta3cdfe38ce0d9f5804270ce5a5d573b7acea6274 (diff)
downloadduser-9caebb1675517798570aea81a831ca2ec1f23153.tar.gz
Added cfg_open(), cfg_get_key(), and cfg_close()
Added configuration file parsing, and removed constants (list_path, LOGFILE). CFG_PATH is defined in duser.h and will need to be changed before compiling. Removed basename in favor of libgen.h Log no longer reports DELETE ALL/SINGLE. Just DELETE. Fixed a ridiculous file truncation mistake in user_del(). Removed dependency on libtre... it sucks. Decided to go with libc searching -- seems to work better. (strfind()) We now validate strings passed as arguments to make sure they cannot cause arbitrary code execution, or accidental damage. (strval()) Added match column to list output. user_add was truncating files... fixed. CMD_FLAG_ADD will verify adding addresses to a mailing list. CMD_FLAG_MOD will display a temporary error (not done) If a corrupt record ever occurs it returns -1.
Diffstat (limited to 'log.c')
-rw-r--r--log.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/log.c b/log.c
index 2aad783..0d5d343 100644
--- a/log.c
+++ b/log.c
@@ -9,12 +9,15 @@
#include <time.h>
#include "duser.h"
+extern char logfile[PATH_MAX];
+//extern char* logfile;
+
int logcleanup()
{
int status = 0;
- if((access(LOGFILE, W_OK)) == 0)
+ if((access(logfile, W_OK)) == 0)
{
- status = unlink(LOGFILE);
+ status = unlink(logfile);
}
return status;
@@ -30,10 +33,10 @@ int COM(const char* func, char *format, ...)
int n;
FILE *logfp = NULL;
- logfp = fopen(LOGFILE, "a+");
+ logfp = fopen(logfile, "a+");
if(logfp == NULL)
{
- fprintf(stderr, "Unable to open %s\n", LOGFILE);
+ fprintf(stderr, "Unable to open %s\n", logfile);
exit(1);
}