X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Funix.c;h=5c3dce06b22a393cba023e8dcd1ed40697604fe9;hb=173f78f50536784bdc6a59d4586ba409b2b69182;hp=41b3bc66e243f00cc7d9b3b95f563912e4985f19;hpb=cccb7ecd623450d5b3ca2391327788c84aed71c8;p=yaz-moved-to-github.git diff --git a/src/unix.c b/src/unix.c index 41b3bc6..5c3dce0 100644 --- a/src/unix.c +++ b/src/unix.c @@ -1,9 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. - * - * $Id: unix.c,v 1.20 2007-10-09 06:00:56 adam Exp $ - * UNIX socket COMSTACK. By Morten Bogeskov. */ /** * \file unix.c @@ -41,7 +38,7 @@ #endif #include -#include +#include #ifndef YAZ_SOCKLEN_T #define YAZ_SOCKLEN_T int @@ -428,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; @@ -740,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