summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs_dir.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-10-20 13:15:26 +0200
committerGreg KH <gregkh@suse.de>2005-04-26 22:06:44 -0700
commit993a633ab848487b8e546f66087595e2dc5aa4af (patch)
treeee1303c8a6b13cbcc9ac97f7a58bcc67d1aee2fd /libsysfs/sysfs_dir.c
parentf8c1ccde6aaf08c858616c9a8a83c06d609f52f5 (diff)
[PATCH] update to libsysfs 1.2.0 and add some stuff klib_fixup
Diffstat (limited to 'libsysfs/sysfs_dir.c')
-rw-r--r--libsysfs/sysfs_dir.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c
index 8ce8522200..52769916cc 100644
--- a/libsysfs/sysfs_dir.c
+++ b/libsysfs/sysfs_dir.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#include "sysfs/libsysfs.h"
+#include "libsysfs.h"
#include "sysfs.h"
/**
@@ -273,7 +273,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr)
errno = EACCES;
return -1;
}
- pgsize = getpagesize();
+ pgsize = sysconf(_SC_PAGESIZE);
fbuf = (char *)calloc(1, pgsize+1);
if (fbuf == NULL) {
dprintf("calloc failed\n");
@@ -513,6 +513,7 @@ struct sysfs_link *sysfs_open_link(const char *linkpath)
safestrcpy(ln->path, linkpath);
if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0
|| (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) {
+ sysfs_close_link(ln);
errno = EINVAL;
dprintf("Invalid link path %s\n", linkpath);
return NULL;
@@ -884,7 +885,8 @@ struct sysfs_attribute *sysfs_get_directory_attribute
attr = (struct sysfs_attribute *)dlist_find_custom
(dir->attributes, attrname, dir_attribute_name_equal);
if (attr != NULL) {
- if ((sysfs_read_attribute(attr)) != 0) {
+ if ((attr->method & SYSFS_METHOD_SHOW) &&
+ (sysfs_read_attribute(attr)) != 0) {
dprintf("Error reading attribute %s\n", attr->name);
return NULL;
}