X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Futils_mount.c;h=176714ce8e66d171071771211d4140e09af7e8a2;hb=efe2a48f63ed4042c101f770d64e1c543fea70ad;hp=176040aa88942016dc3584ab0b7db38ef3f03141;hpb=40e9303e0532660cf854a153dff204eaaab33214;p=collectd.git diff --git a/src/utils_mount.c b/src/utils_mount.c index 176040aa..176714ce 100644 --- a/src/utils_mount.c +++ b/src/utils_mount.c @@ -1,6 +1,6 @@ /** * collectd - src/utils_mount.c - * Copyright (C) 2005 Niki W. Waibel + * Copyright (C) 2005,2006 Niki W. Waibel * * This program is free software; you can redistribute it and/ * or modify it under the terms of the GNU General Public Li- @@ -429,15 +429,21 @@ static cu_mount_t *cu_mount_getfsstat (void) /* Get the number of mounted file systems */ if ((bufsize = getfsstat (NULL, 0, MNT_NOWAIT)) < 1) + { + DBG ("getfsstat failed: %s", strerror (errno)); return (NULL); + } - if ((buf = (struct statfs *) malloc (bufsize * sizeof (struct statfs))) == NULL) + if ((buf = (struct statfs *) malloc (bufsize * sizeof (struct statfs))) + == NULL) return (NULL); memset (buf, '\0', bufsize * sizeof (struct statfs)); - /* FIXME: If `bufsize' in bytes or structures? */ - if ((num = getfsstat (buf, bufsize, MNT_NOWAIT)) < 1) + /* The bufsize needs to be passed in bytes. Really. This is not in the + * manpage.. -octo */ + if ((num = getfsstat (buf, bufsize * sizeof (struct statfs), MNT_NOWAIT)) < 1) { + DBG ("getfsstat failed: %s", strerror (errno)); free (buf); return (NULL); }