Mercurial > dovecot > core-2.2
view src/lib/unix-socket-create.c @ 15187:02451e967a06
Renamed network.[ch] to net.[ch].
The function prefixes already started with net_ instead of network_.
And icecap wants to use network.h for other purpose. :)
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 03 Oct 2012 18:17:26 +0300 |
parents | ba770cba5598 |
children | 90710c6c3beb |
line wrap: on
line source
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "net.h" #include "unix-socket-create.h" #include <unistd.h> #include <sys/stat.h> int unix_socket_create(const char *path, int mode, uid_t uid, gid_t gid, int backlog) { mode_t old_umask; int fd; old_umask = umask(0777 ^ mode); fd = net_listen_unix_unlink_stale(path, backlog); umask(old_umask); if (fd < 0) { i_error("net_listen_unix(%s) failed: %m", path); return -1; } if (uid != (uid_t)-1 || gid != (gid_t)-1) { /* set correct permissions */ if (chown(path, uid, gid) < 0) { i_error("chown(%s, %s, %s) failed: %m", path, dec2str(uid), dec2str(gid)); return -1; } } return fd; }