[Ocfs2-tools-devel] [PATCH 6/7] mount.ocfs2: fix build warnings
Joseph Qi
joseph.qi at huawei.com
Fri Mar 4 01:51:16 PST 2016
Fix the following build warnings:
1) warning: no previous prototype for ‘canonicalize_dm_name’
2) warning: assignment makes integer from pointer without a cast
3) warning: implicit declaration of function ‘isdigit’
Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
---
mount.ocfs2/sundries.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mount.ocfs2/sundries.c b/mount.ocfs2/sundries.c
index 2e1b95a..c745595 100644
--- a/mount.ocfs2/sundries.c
+++ b/mount.ocfs2/sundries.c
@@ -12,6 +12,8 @@
#include <stdio.h>
#include <string.h>
#include <mntent.h> /* for MNTTYPE_SWAP */
+#include<ctype.h>
+
#include "fstab.h"
#include "sundries.h"
#include "realpath.h"
@@ -229,13 +231,13 @@ matching_opts (const char *options, const char *test_opts) {
* Since 2.6.29 (patch 784aae735d9b0bba3f8b9faef4c8b30df3bf0128) kernel sysfs
* provides the real DM device names in /sys/block/<ptname>/dm/name
*/
-char *
+static char *
canonicalize_dm_name(const char *ptname)
{
FILE *f;
size_t sz;
char path[256], name[256], *res = NULL;
- int err;
+ char *s;
snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);
f = fopen(path, "r");
@@ -243,9 +245,9 @@ canonicalize_dm_name(const char *ptname)
return NULL;
/* read "<name>\n" from sysfs */
- err = fgets(name, sizeof(name), f);
+ s = fgets(name, sizeof(name), f);
sz = strlen(name);
- if (!err && sz > 1) {
+ if (!s && sz > 1) {
name[sz - 1] = '\0';
snprintf(path, sizeof(path), "/dev/mapper/%s", name);
res = strdup(path);
--
1.8.4.3
More information about the Ocfs2-tools-devel
mailing list