chattr-util.c revision 11c3a36649e5e5e77db499c92f3cdcbd619efd3a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include "chattr-util.h"
#include "fd-util.h"
#include "macro.h"
return -errno;
/* Explicitly check whether this is a regular file or
* directory. If it is anything else (such as a device node or
* fifo), then the ioctl will not hit the file systems but
* possibly drivers, where the ioctl might have different
* effects. Notably, DRM is using the same ioctl() number. */
return -ENOTTY;
if (mask == 0)
return 0;
return -errno;
return 0;
return -errno;
return 1;
}
assert(p);
if (mask == 0)
return 0;
if (fd < 0)
return -errno;
}
return -errno;
return -ENOTTY;
return -errno;
return 0;
}
int read_attr_path(const char *p, unsigned *ret) {
assert(p);
if (fd < 0)
return -errno;
}