[LEDE-DEV] [PATCH mountd 4/5] mountd: Fix unused result in mount.c for symlink()

Florian Fainelli f.fainelli at gmail.com
Sun Mar 5 16:50:15 PST 2017


Fixes the following warning:

mountd-2016-12-19-dd5799c9/mount.c:454:3: note: each undeclared identifier is reported only once for each function it appears in
mountd-2016-12-19-dd5799c9/mount.c: In function 'mount_add_list':
mountd-2016-12-19-dd5799c9/mount.c:163:10: error: ignoring return value of 'symlink', declared with attribute warn_unused_result [-Werror=unused-result]
   symlink(tmp2, tmp);
          ^

Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 mount.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index fa01eeba7402..fd5d073ca3eb 100644
--- a/mount.c
+++ b/mount.c
@@ -139,6 +139,7 @@ static void mount_add_list(char *name, char *dev, char *serial,
 {
 	struct mount *mount;
 	char tmp[64], tmp2[64];
+	int ret;
 	if(fs <= MBR || fs > LASTFS)
 		return;
 	mount  = malloc(sizeof(struct mount));
@@ -160,7 +161,9 @@ static void mount_add_list(char *name, char *dev, char *serial,
 		log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]);
 		snprintf(tmp, 64, "%s%s", uci_path, name);
 		snprintf(tmp2, 64, "/tmp/run/mountd/%s", dev);
-		symlink(tmp2, tmp);
+		ret = symlink(tmp2, tmp);
+		if (ret < 0)
+			return;
 		mount_new("/tmp/run/mountd/", dev);
 		system_printf("ACTION=add DEVICE=%s NAME=%s /sbin/hotplug-call mount", dev, name);
 	}
-- 
2.9.3




More information about the Lede-dev mailing list