X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=libsysfs%2Fsysfs_dir.c;h=7d98c669c65d575e06bf5f4105950626c93016b0;hb=3cf745e128ba02fcea33bd13190b713f00119150;hp=c86617934bb47c37a5955e0546f9551fe009c9d1;hpb=f385ff6512012a75b8381938dd3f55f991b53e9a;p=elogind.git diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index c86617934..7d98c669c 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -150,7 +150,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) errno = EACCES; return -1; } - pgsize = sysconf(_SC_PAGESIZE); + pgsize = getpagesize(); fbuf = (char *)calloc(1, pgsize+1); if (!fbuf) { dprintf("calloc failed\n"); @@ -244,7 +244,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, close(fd); return -1; } else if ((unsigned int)length != len) { - dprintf("Could not write %d bytes to attribute %s\n", + dprintf("Could not write %zd bytes to attribute %s\n", len, sysattr->name); /* * since we could not write user supplied number of bytes, @@ -338,7 +338,7 @@ struct sysfs_attribute *get_attribute(void *dev, const char *name) SYSFS_PATH_MAX); safestrcatmax(path, "/", SYSFS_PATH_MAX); safestrcatmax(path, name, SYSFS_PATH_MAX); - if (!(sysfs_path_is_file(path))) + if (!sysfs_path_is_file(path)) cur = add_attribute((void *)dev, path); return cur; } @@ -373,7 +373,7 @@ struct dlist *read_dir_links(const char *path) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_link(file_path)) == 0) { + if (!sysfs_path_is_link(file_path)) { if (!linklist) { linklist = dlist_new_with_delete (SYSFS_NAME_LEN, sysfs_del_name); @@ -421,7 +421,7 @@ struct dlist *read_dir_subdirs(const char *path) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_dir(file_path)) == 0) { + if (!sysfs_path_is_dir(file_path)) { if (!dirlist) { dirlist = dlist_new_with_delete (SYSFS_NAME_LEN, sysfs_del_name); @@ -471,7 +471,7 @@ struct dlist *get_attributes_list(void *dev) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_file(file_path)) == 0) { + if (!sysfs_path_is_file(file_path)) { if (((struct sysfs_device *)dev)->attrlist) { /* check if attr is already in the list */ attr = (struct sysfs_attribute *)