X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Funix.c;h=5c3dce06b22a393cba023e8dcd1ed40697604fe9;hb=9748d1f21b8a1c8c6f14ef9384c0e4fdb2d41585;hp=5d6cad19cc88ed87c5d7020d89c8abc05c913421;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;p=yaz-moved-to-github.git diff --git a/src/unix.c b/src/unix.c index 5d6cad1..5c3dce0 100644 --- a/src/unix.c +++ b/src/unix.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. */ /** @@ -38,7 +38,7 @@ #endif #include -#include +#include #ifndef YAZ_SOCKLEN_T #define YAZ_SOCKLEN_T int @@ -425,8 +425,16 @@ static int unix_bind(COMSTACK h, void *address, int mode) h->cerrno = CSYSERR; return -1; } - chown(path, sp->uid, sp->gid); - chmod(path, sp->umask != -1 ? sp->umask : 0666); + if (chown(path, sp->uid, sp->gid)) + { + h->cerrno = CSYSERR; + return -1; + } + if (chmod(path, sp->umask != -1 ? sp->umask : 0666)) + { + h->cerrno = CSYSERR; + return -1; + } if (mode == CS_SERVER && listen(h->iofile, 100) < 0) { h->cerrno = CSYSERR; @@ -737,6 +745,7 @@ static int unix_set_blocking(COMSTACK p, int flags) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab