check_and_open.c revision b8dede30141cf87fb62aca918d04e411fac82946
/*
SSSD
Check file permissions and open file
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fcntl.h>
#include <unistd.h>
{
int ret;
struct stat fd_stat_buf;
*fd = -1;
if (ret == -1) {
return errno;
}
return EINVAL;
}
return EINVAL;
}
return EINVAL;
}
if (*fd == -1) {
return errno;
}
if (ret == -1) {
return errno;
}
*fd = -1;
return EIO;
}
return EOK;
}