Changeset 2161
- Timestamp:
- 04/29/2008 11:03:41 AM (2 weeks ago)
- Files:
-
- branches/lighttpd-1.4.x/NEWS (modified) (1 diff)
- branches/lighttpd-1.4.x/src/configfile.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/lighttpd-1.4.x/NEWS
r2157 r2161 23 23 * Fix mod_magnet to set con->mode = p->id if it generates content, so returning 4xx/5xx doesn't append an error page 24 24 * Remove lighttpd.spec* from source, fixing all problems with it ;-) 25 * Do not rely on PATH_MAX (POSIX does not require it) (#580) 25 26 26 27 - 1.4.19 - 2008-03-10 branches/lighttpd-1.4.x/src/configfile.c
r2147 r2161 8 8 #include <stdio.h> 9 9 #include <ctype.h> 10 #include <limits.h> 10 11 #include <assert.h> 11 12 … … 910 911 } 911 912 913 static char* getCWD() { 914 char *s, *s1; 915 size_t len; 916 #ifdef PATH_MAX 917 len = PATH_MAX; 918 #else 919 len = 4096; 920 #endif 921 922 s = malloc(len); 923 if (!s) return NULL; 924 while (NULL == getcwd(s, len)) { 925 if (errno != ERANGE || SSIZE_MAX - len < len) return NULL; 926 len *= 2; 927 s1 = realloc(s, len); 928 if (!s1) { 929 free(s); 930 return NULL; 931 } 932 s = s1; 933 } 934 return s; 935 } 936 912 937 int config_parse_cmd(server *srv, config_t *context, const char *cmd) { 913 938 proc_handler_t proc; … … 916 941 buffer *source; 917 942 buffer *out; 918 char oldpwd[PATH_MAX];919 920 if (NULL == getcwd(oldpwd, sizeof(oldpwd))) {943 char *oldpwd; 944 945 if (NULL == (oldpwd = getCWD())) { 921 946 log_error_write(srv, __FILE__, __LINE__, "s", 922 947 "cannot get cwd", strerror(errno)); … … 943 968 buffer_free(out); 944 969 chdir(oldpwd); 970 free(oldpwd); 945 971 return ret; 946 972 }

