X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=afs.c;h=57ec13385f6c2725be4b5bb7a3d17faa10d024d8;hb=1709cc8f;hp=0accc45108f7c6ba0c2a3a89595d957d8a566920;hpb=78cc9c57ad9b1cc389956957030d37f71cb60a07;p=paraslash.git diff --git a/afs.c b/afs.c index 0accc451..57ec1338 100644 --- a/afs.c +++ b/afs.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -706,7 +707,7 @@ static int open_afs_tables(void) int i, ret; get_database_dir(); - PARA_NOTICE_LOG("opening %u osl tables in %s\n", NUM_AFS_TABLES, + PARA_NOTICE_LOG("opening %d osl tables in %s\n", NUM_AFS_TABLES, database_dir); for (i = 0; i < NUM_AFS_TABLES; i++) { ret = afs_tables[i].open(database_dir); @@ -888,7 +889,7 @@ static int execute_server_command(fd_set *rfds) return ret; buf[n] = '\0'; if (strcmp(buf, "new")) - return -E_BAD_CMD; + return -ERRNO_TO_PARA_ERROR(EINVAL); return open_next_audio_file(); } @@ -1024,6 +1025,13 @@ __noreturn void afs_init(uint32_t cookie, int socket_fd) register_command_task(cookie, &s); s.default_timeout.tv_sec = 0; s.default_timeout.tv_usec = 999 * 1000; + ret = write(socket_fd, "\0", 1); + if (ret != 1) { + if (ret == 0) + errno = EINVAL; + ret = -ERRNO_TO_PARA_ERROR(errno); + goto out_close; + } ret = schedule(&s); sched_shutdown(&s); out_close: @@ -1195,7 +1203,7 @@ __must_check int afs_event(enum afs_events event, struct para_buffer *pb, continue; ret = t->event_handler(event, pb, data); if (ret < 0) { - PARA_CRIT_LOG("table %s, event %d: %s\n", t->name, + PARA_CRIT_LOG("table %s, event %u: %s\n", t->name, event, para_strerror(-ret)); return ret; }