Minor win32 fixes, fix path parsing in conf validation to fix ticket #48

This commit is contained in:
Ron Pedde 2006-04-10 19:02:39 +00:00
parent f83f66130b
commit 964285cf41
4 changed files with 14 additions and 8 deletions

View File

@ -138,18 +138,20 @@ int _conf_makedir(char *path,char *user) {
DPRINTF(E_FATAL,L_CONF,"Malloc error\n");
}
next_token=pathdup+1;
next_token=pathdup;
while(*next_token && (*next_token != PATHSEP))
next_token++;
if(*next_token)
next_token++;
memset(path_buffer,0,sizeof(path_buffer));
while((token=strsep(&next_token,"/"))) {
while((token=strsep(&next_token,PATHSEP_STR))) {
if((strlen(path_buffer) + strlen(token)) < PATH_MAX) {
strcat(path_buffer,"/");
strcat(path_buffer,PATHSEP_STR);
strcat(path_buffer,token);
if(!_conf_existdir(path_buffer)) {
/* FIXME: this is wrong -- it should really be 0700 owned by
* the runas user. That would require some os_ indirection
*/
DPRINTF(E_DBG,L_CONF,"Making %s\n",path_buffer);
if((mkdir(path_buffer,0700)) && (errno != EEXIST)) {
free(pathdup);

View File

@ -7,6 +7,9 @@
#ifndef _OS_UNIX_H_
#define _OS_UNIX_H_
#define PATHSEP '/'
#define PATHSEP_STR "/"
/* unix-specific functions */
extern int os_drop_privs(char *user);
void os_set_pidfile(char *file);

View File

@ -12,7 +12,8 @@
#define MAXNAMLEN 255
#define DIRBLKSIZ 512
#define PATHSEP '\\'
#define PATHSEP_STR "\\"
struct timezone {
int tz_minuteswest;

View File

@ -71,7 +71,7 @@
#define HOST "unknown-windows-ick"
#define SERVICENAME "Multithreaded DAAP Server"
#define DEFAULT_CONFIGFILE os_configpath()
#define CONFFILE os_configpath()
extern char *os_configpath(void);