diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 18 | ||||
| -rw-r--r-- | src/server.c | 11 | ||||
| -rw-r--r-- | src/world.c | 1 |
3 files changed, 27 insertions, 3 deletions
@@ -1,3 +1,21 @@ +/* + * NetCosm - a MUD server + * Copyright (C) 2016 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #include "globals.h" #include "server.h" diff --git a/src/server.c b/src/server.c index a4280c2..a4558bc 100644 --- a/src/server.c +++ b/src/server.c @@ -277,7 +277,7 @@ static void new_connection_cb(EV_P_ ev_io *w, int revents) if(socketpair(AF_UNIX, SOCK_SEQPACKET, 0, outpipe) < 0) { if(socketpair(AF_UNIX, SOCK_DGRAM, 0, outpipe) < 0) - error("error creating pipe, need linux kernel >= 3.4"); + error("error creating IPC pipe"); } } @@ -290,7 +290,7 @@ static void new_connection_cb(EV_P_ ev_io *w, int revents) /* child */ are_child = true; - /* close our file descriptors */ + /* close unused file descriptors */ close(readpipe[0]); close(outpipe[1]); close(server_socket); @@ -396,7 +396,12 @@ static void parse_args(int argc, char *argv[]) autopass = argv[++i]; break; case 'd': /* set data prefix */ - chdir(argv[++i]); + mkdir(argv[++i], 0700); + if(chdir(argv[i]) < 0) + { + debugf("Cannot access data prefix.\n"); + exit(0); + } break; default: c = 'h'; diff --git a/src/world.c b/src/world.c index 222155d..b3bb4b3 100644 --- a/src/world.c +++ b/src/world.c @@ -248,6 +248,7 @@ bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz /* read in the room name -> room map */ world_map = hash_init(world_sz * 2, hash_djb, compare_strings); + hash_setfreekey_cb(world_map, free); for(unsigned int i = 0; i < world_sz; ++i) { |