← Back to team overview

compiz team mailing list archive

[Merge] lp:~compiz-team/compiz/build-fixes-part-2 into lp:compiz

 

Sam Spilsbury has proposed merging lp:~compiz-team/compiz/build-fixes-part-2 into lp:compiz with lp:~compiz-team/compiz/build-fixes-part-1 as a prerequisite.

Requested reviews:
  compiz packagers (compiz)

For more details, see:
https://code.launchpad.net/~compiz-team/compiz/build-fixes-part-2/+merge/106514

Testers should really test the last item in the branch pipeline lp:~compiz-team/compiz/build-fixes-part-10-animationaddon-plugin

This branch fixes some warnings in libcompizconfig. Always check the return value of asprintf.
-- 
https://code.launchpad.net/~compiz-team/compiz/build-fixes-part-2/+merge/106514
Your team compiz packagers is requested to review the proposed merge of lp:~compiz-team/compiz/build-fixes-part-2 into lp:compiz.
=== modified file 'compizconfig/libcompizconfig/backend/src/ini.c'
--- compizconfig/libcompizconfig/backend/src/ini.c	2012-05-20 10:45:42 +0000
+++ compizconfig/libcompizconfig/backend/src/ini.c	2012-05-20 10:45:48 +0000
@@ -82,15 +82,19 @@
     configDir = getenv ("XDG_CONFIG_HOME");
     if (configDir && strlen (configDir))
     {
-	asprintf (&fileName, "%s/%s/%s.ini", configDir, SETTINGPATH, profile);
+	if (asprintf (&fileName, "%s/%s/%s.ini", configDir, SETTINGPATH, profile) == -1)
+	    return NULL;
+
 	return fileName;
     }
 
     configDir = getenv ("HOME");
     if (configDir && strlen (configDir))
     {
-	asprintf (&fileName, "%s/.config/%s/%s.ini", configDir, SETTINGPATH,
-		  profile);
+	if (asprintf (&fileName, "%s/.config/%s/%s.ini", configDir, SETTINGPATH,
+		      profile) == -1)
+	    return NULL;
+
 	return fileName;
     }
 
@@ -265,7 +269,8 @@
     if (!data)
 	return;
 
-    asprintf (&keyName, "s%d_%s", context->screenNum, setting->name);
+    if (asprintf (&keyName, "s%d_%s", context->screenNum, setting->name) == -1)
+	return;
 
     switch (setting->type)
     {
@@ -455,7 +460,8 @@
     if (!data)
 	return;
 
-    asprintf (&keyName, "s%d_%s", context->screenNum, setting->name);
+    if (asprintf (&keyName, "s%d_%s", context->screenNum, setting->name) == -1)
+	return;
 
     if (setting->isDefault)
     {
@@ -656,7 +662,8 @@
     configDir = getenv ("XDG_CONFIG_HOME");
     if (configDir && strlen (configDir))
     {
-	asprintf (&filePath, "%s/%s", configDir, SETTINGPATH);
+	if (asprintf (&filePath, "%s/%s", configDir, SETTINGPATH) == -1)
+	    return NULL;
 	
 	ret = scanConfigDir(filePath);
 	free(filePath);
@@ -669,7 +676,9 @@
     if (!homeDir)
 	return NULL;
 
-    asprintf (&filePath, "%s/.config/%s", homeDir, SETTINGPATH);
+    if (asprintf (&filePath, "%s/.config/%s", homeDir, SETTINGPATH) == -1)
+	filePath = NULL;
+
     if (!filePath)
 	return NULL;
 

=== modified file 'compizconfig/libcompizconfig/src/config.c'
--- compizconfig/libcompizconfig/src/config.c	2012-05-20 10:45:42 +0000
+++ compizconfig/libcompizconfig/src/config.c	2012-05-20 10:45:48 +0000
@@ -47,7 +47,7 @@
     configDir = getenv ("HOME");
     if (configDir && strlen (configDir))
     {
-	if (asprintf (&fileName, "%s/.config/%s/config", configDir, SETTINGPATH))
+	if (asprintf (&fileName, "%s/.config/%s/config", configDir, SETTINGPATH) == -1)
 	    fileName = NULL;
 
 	return fileName;

=== modified file 'compizconfig/libcompizconfig/src/ini.c'
--- compizconfig/libcompizconfig/src/ini.c	2012-05-20 10:45:42 +0000
+++ compizconfig/libcompizconfig/src/ini.c	2012-05-20 10:45:48 +0000
@@ -625,7 +625,7 @@
 {
     char *string = NULL;
 
-    if (asprintf (&string, "%f", value))
+    if (asprintf (&string, "%f", value) == -1)
 	string = NULL;
 
     if (string)

=== modified file 'compizconfig/libcompizconfig/src/main.c'
--- compizconfig/libcompizconfig/src/main.c	2012-05-20 10:45:42 +0000
+++ compizconfig/libcompizconfig/src/main.c	2012-05-20 10:45:48 +0000
@@ -2699,7 +2699,7 @@
 
     if (home && strlen (home))
     {
-	if (asprintf (&backenddir, "%s/.compizconfig/backends", home))
+	if (asprintf (&backenddir, "%s/.compizconfig/backends", home) == -1)
 	    backenddir = NULL;
 
 	if (backenddir)
@@ -2709,7 +2709,7 @@
 	}
     }
 
-    if (asprintf (&backenddir, "%s/compizconfig/backends", LIBDIR))
+    if (asprintf (&backenddir, "%s/compizconfig/backends", LIBDIR) == -1)
 	backenddir = NULL;
 
     if (backenddir)