Use S_ISDIR to determine file directoryishness

This commit is contained in:
Ron Pedde 2007-04-15 20:36:00 +00:00
parent e991d1ec08
commit a6b9099e01
2 changed files with 5 additions and 5 deletions

View File

@ -343,7 +343,7 @@ void config_handler(WS_CONNINFO *pwsc) {
/* this is quite broken, but will work */ /* this is quite broken, but will work */
os_stat(resolved_path,&sb); os_stat(resolved_path,&sb);
if(sb.st_mode & S_IFDIR) { if(S_ISDIR(sb.st_mode)) {
ws_addresponseheader(pwsc,"Location","/index.html"); ws_addresponseheader(pwsc,"Location","/index.html");
ws_returnerror(pwsc,302,"Moved"); ws_returnerror(pwsc,302,"Moved");
config_set_status(pwsc,0,NULL); config_set_status(pwsc,0,NULL);

View File

@ -107,7 +107,7 @@ void upnp_build_packet(char *packet, int len, UPNP_PACKETINFO *pi) {
port = conf_get_int("general","port",0); port = conf_get_int("general","port",0);
len = upnp_strcat("NOTIFY * HTTP/1.0\r\n",packet,len); len = upnp_strcat("NOTIFY * HTTP/1.1\r\n",packet,len);
if(pi->location) { if(pi->location) {
gethostname(hostname,sizeof(hostname)); gethostname(hostname,sizeof(hostname));
snprintf(buffer,sizeof(buffer),"LOCATION: http://%s:%d%s\r\n", snprintf(buffer,sizeof(buffer),"LOCATION: http://%s:%d%s\r\n",