X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audiod.c;h=b0f9f786932be2e44e5c87bb9411345746e16ff1;hp=7596c5c54939e9178d186a49e21a1f5f395c93c6;hb=ff5444a95fa551c0bac1ca74f36770276a82703e;hpb=69f0930489da9ace5af8aee104ad21d188aed387 diff --git a/audiod.c b/audiod.c index 7596c5c5..b0f9f786 100644 --- a/audiod.c +++ b/audiod.c @@ -1157,7 +1157,7 @@ static int init_stream_io(void) free(cmd); /* filters */ filter_init(filters); - nf = MAX(2, conf.filter_given) + 1; + nf = PARA_MAX(2, conf.filter_given) + 1; PARA_INFO_LOG("allocating space for %d filters\n", nf); FOR_EACH_AUDIO_FORMAT(i) { afi[i].filter_conf = para_malloc(nf * sizeof(char *)); @@ -1243,7 +1243,7 @@ out: return ret; } -static int com_stat(int fd, __unused int argc, __unused char **argv) +static int com_stat(int fd, __a_unused int argc, __a_unused char **argv) { int i, ret; char *buf = NULL; @@ -1373,27 +1373,27 @@ err_out: return 1; } -static int __noreturn com_term(int fd, __unused int argc, __unused char **argv) +static int __noreturn com_term(int fd, __a_unused int argc, __a_unused char **argv) { close(fd); clean_exit(EXIT_SUCCESS, "terminating on user request"); } -static int com_on(int fd, __unused int argc, __unused char **argv) +static int com_on(int fd, __a_unused int argc, __a_unused char **argv) { audiod_status = AUDIOD_ON; close(fd); return 1; } -static int com_off(int fd, __unused int argc, __unused char **argv) +static int com_off(int fd, __a_unused int argc, __a_unused char **argv) { audiod_status = AUDIOD_OFF; close(fd); return 1; } -static int com_sb(int fd, __unused int argc, __unused char **argv) +static int com_sb(int fd, __a_unused int argc, __a_unused char **argv) { audiod_status = AUDIOD_STANDBY; close(fd); @@ -1417,14 +1417,14 @@ static int com_cycle(int fd, int argc, char **argv) return 1; } -static int check_perms(struct ucred *c) +static int check_perms(uid_t uid) { int i; if (!conf.user_allow_given) return 1; for (i = 0; i < conf.user_allow_given; i++) - if (c->uid == conf.user_allow_arg[i]) + if (uid == conf.user_allow_arg[i]) return 1; return -E_UCRED_PERM; } @@ -1432,7 +1432,6 @@ static int check_perms(struct ucred *c) static int handle_connect(void) { int i, argc, ret, clifd = -1; - struct ucred c; char *buf = para_malloc(MAXLINE), **argv = NULL; struct sockaddr_un unix_addr; @@ -1440,12 +1439,12 @@ static int handle_connect(void) if (ret < 0) goto out; clifd = ret; - ret = recv_cred_buffer(clifd, buf, MAXLINE - 1, &c); + ret = recv_cred_buffer(clifd, buf, MAXLINE - 1); if (ret < 0) goto out; - PARA_INFO_LOG("pid: %i, uid: %i, gid: %i, ret: %i, buf: %s\n", c.pid, c.uid, c.gid, ret, buf); + PARA_INFO_LOG("connection from user %i\n", ret); buf[ret] = '\0'; - ret = check_perms(&c); + ret = check_perms(ret); if (ret < 0) goto out; argc = split_args(buf, &argv, "\n"); @@ -1525,7 +1524,7 @@ static void audiod_pre_select(fd_set *rfds, fd_set *wfds, struct timeval *tv, a = &afi[s->format]; ret = a->receiver->pre_select(rn, rfds, wfds, tv); // PARA_NOTICE_LOG("%s preselect: %d\n", a->receiver->name, ret); - *max_fileno = MAX(*max_fileno, ret); + *max_fileno = PARA_MAX(*max_fileno, ret); } } static void audiod_post_select(int select_ret, fd_set *rfds, fd_set *wfds)