From 34b3dc9b470946bc35d8a33e49a6d8d8ab74c3f1 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sun, 6 Jun 1999 19:53:59 +0000 Subject: - Fix PSLS issues - Add a standard info function for the session module (use them!) - Replace PATH_MAX with MAXPATHLEN (that's our platform indepedent constant) --- ext/session/mod_files.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ext/session/mod_files.c') diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 9ec9ef6998..6d998827c1 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -42,10 +42,12 @@ typedef struct { char *basedir; } ps_files; + ps_module ps_mod_files = { PS_MOD(files) }; + #define PS_FILES_DATA ps_files *data = *mod_data PS_OPEN_FUNC(files) @@ -76,7 +78,7 @@ PS_CLOSE_FUNC(files) static void _ps_files_open(ps_files *data, const char *key) { - char buf[PATH_MAX]; + char buf[MAXPATHLEN]; if(data->fd < 0 || !data->lastkey || strcmp(key, data->lastkey)) { if(data->lastkey) efree(data->lastkey); @@ -84,7 +86,7 @@ static void _ps_files_open(ps_files *data, const char *key) data->lastkey = estrdup(key); - snprintf(buf, PATH_MAX, "%s/%s", data->basedir, key); + snprintf(buf, MAXPATHLEN, "%s/%s", data->basedir, key); data->fd = open(buf, O_CREAT | O_RDWR, 0600); if(data->fd > -1) { flock(data->fd, LOCK_EX); @@ -137,10 +139,10 @@ PS_WRITE_FUNC(files) PS_DELETE_FUNC(files) { - char buf[PATH_MAX]; + char buf[MAXPATHLEN]; PS_FILES_DATA; - snprintf(buf, PATH_MAX, "%s/%s", data->basedir, key); + snprintf(buf, MAXPATHLEN, "%s/%s", data->basedir, key); unlink(buf); return SUCCESS; -- cgit v1.2.1