Better errno, from joshe.

This commit is contained in:
Nicholas Marriott 2009-04-01 20:15:48 +00:00
parent d4947fc4cb
commit 3932da2522

8
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.111 2009-04-01 18:21:40 nicm Exp $ */
/* $Id: tmux.c,v 1.112 2009-04-01 20:15:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -190,11 +190,11 @@ makesockpath(const char *label)
if (lstat(base, &sb) != 0)
return (NULL);
if (!S_ISDIR(sb.st_mode) || sb.st_uid != uid) {
errno = EACCES;
if (!S_ISDIR(sb.st_mode)) {
errno = ENOTDIR;
return (NULL);
}
if ((sb.st_mode & (S_IRWXG|S_IRWXO)) != 0) {
if (sb.st_uid != uid || (sb.st_mode & (S_IRWXG|S_IRWXO)) != 0) {
errno = EACCES;
return (NULL);
}