From 0e60fff9acb44fccc38b86d0cca7af7cc1009f63 Mon Sep 17 00:00:00 2001
From: David Maciejak <david.maciejak@gmail.com>
Date: Fri, 28 Feb 2014 11:21:47 +0700
Subject: [PATCH] Fixed compiler warnings

---
 WPrefs.app/Appearance.c    | 15 +++++++++++----
 WPrefs.app/MouseSettings.c |  4 ++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 3bd571a..500cbdd 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -1261,17 +1261,24 @@ static Pixmap loadRImage(WMScreen * scr, const char *path)
 {
 	FILE *f;
 	RImage *image;
-	int w, h, d;
+	int w, h, d, cnt;
 	Pixmap pixmap;
 
 	f = fopen(path, "rb");
 	if (!f)
 		return None;
 
-	fscanf(f, "%02x%02x%1x", &w, &h, &d);
-
+	cnt = fscanf(f, "%02x%02x%1x", &w, &h, &d);
+	if (cnt != 3) {
+		fclose(f);
+		return None;
+	}
 	image = RCreateImage(w, h, d == 4);
-	fread(image->data, 1, w * h * d, f);
+	cnt = w * h * d;
+	if (fread(image->data, 1, cnt, f) != cnt) {
+		fclose(f);
+		return None;
+	}
 	fclose(f);
 
 	RConvertImage(WMScreenRContext(scr), image, &pixmap);
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index 2aa500b..f83ec3a 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -714,8 +714,8 @@ static void storeCommandInScript(const char *cmd, const char *line)
 		wfree(tmppath);
 	}
 	sprintf(buffer, "chmod u+x %s", path);
-	system(buffer);
-
+	if (system(buffer) == -1)
+		werror(_("could not execute command"));
  end:
 	wfree(path);
 	if (f) {
-- 
1.8.3.2

