summaryrefslogtreecommitdiffstats
path: root/lib/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r--lib/sysfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c
index aba12864e..bc380c030 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -152,6 +152,13 @@ int sysfs_stat(struct sysfs_cxt *cxt, const char *attr, struct stat *st)
return rc;
}
+int sysfs_has_attribute(struct sysfs_cxt *cxt, const char *attr)
+{
+ struct stat st;
+
+ return sysfs_stat(cxt, attr, &st) == 0;
+}
+
static int sysfs_open(struct sysfs_cxt *cxt, const char *attr)
{
int fd = open_at(cxt->dir_fd, cxt->dir_path, attr, O_RDONLY);