[LEDE-DEV,fstools] overlay: fix compilation with glibc

Message ID 20180107180402.14368-1-roman@advem.lv
State Accepted
Delegated to: John Crispin
Headers show
Series
  • [LEDE-DEV,fstools] overlay: fix compilation with glibc
Related show

Commit Message

Roman Yeryomin Jan. 7, 2018, 6:04 p.m.
glibc fails with:
warn_unused_result [-Wunused-result]
   system("cp -a /tmp/root/upper/* / 2>/dev/null");

Regression intoroduced with 11efbf3b90f031ce634fc38cad07a4aef2985777
Reported here:
https://www.mail-archive.com/lede-dev@lists.infradead.org/msg10502.html

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 libfstools/overlay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Florian Fainelli Jan. 12, 2018, 8:37 p.m. | #1
On 01/07/2018 10:04 AM, Roman Yeryomin wrote:
> glibc fails with:
> warn_unused_result [-Wunused-result]
>    system("cp -a /tmp/root/upper/* / 2>/dev/null");
> 
> Regression intoroduced with 11efbf3b90f031ce634fc38cad07a4aef2985777
> Reported here:
> https://www.mail-archive.com/lede-dev@lists.infradead.org/msg10502.html
> 
> Signed-off-by: Roman Yeryomin <roman@advem.lv>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Just met that problem as well.

Patch

diff --git a/libfstools/overlay.c b/libfstools/overlay.c
index 0187a55..1d69f5a 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -257,7 +257,8 @@  jffs2_switch(struct volume *v)
 
 		/* try hard to be in sync */
 		ULOG_INFO("syncronizing overlay\n");
-		system("cp -a /tmp/root/upper/* / 2>/dev/null");
+		if (system("cp -a /tmp/root/upper/* / 2>/dev/null"))
+			ULOG_ERR("failed to sync jffs2 overlay\n");
 		break;
 
 	case FS_EXT4: