celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject svn commit: r1659210 - in /celix/trunk: framework/private/src/properties.c launcher/private/src/launcher.c
Date Thu, 12 Feb 2015 10:38:39 GMT
Author: pnoltes
Date: Thu Feb 12 10:38:39 2015
New Revision: 1659210

URL: http://svn.apache.org/r1659210
Log:
CELIX-224: properties_load will now return NULL if there was a problem. launcher will check
this and print errno when a problem has occured.

Modified:
    celix/trunk/framework/private/src/properties.c
    celix/trunk/launcher/private/src/launcher.c

Modified: celix/trunk/framework/private/src/properties.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/properties.c?rev=1659210&r1=1659209&r2=1659210&view=diff
==============================================================================
--- celix/trunk/framework/private/src/properties.c (original)
+++ celix/trunk/framework/private/src/properties.c Thu Feb 12 10:38:39 2015
@@ -47,7 +47,7 @@ void properties_destroy(properties_pt pr
 }
 
 properties_pt properties_load(char *filename) {
-	properties_pt props = properties_create();
+	properties_pt props = NULL;
 	FILE *file = fopen ( filename, "r" );
 
 	char line[1024];
@@ -60,6 +60,7 @@ properties_pt properties_load(char *file
 	char *output = NULL;
 
 	if (file != NULL ) {
+		props = properties_create();
 		while ( fgets ( line, sizeof line, file ) != NULL ) {
 
 			linePos = 0;

Modified: celix/trunk/launcher/private/src/launcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/launcher/private/src/launcher.c?rev=1659210&r1=1659209&r2=1659210&view=diff
==============================================================================
--- celix/trunk/launcher/private/src/launcher.c (original)
+++ celix/trunk/launcher/private/src/launcher.c Thu Feb 12 10:38:39 2015
@@ -96,8 +96,9 @@ int main(int argc, char *argv[]) {
 
     config = properties_load(config_file);
 	// Make sure we've read it and that nothing went wrong with the file access...
-	if (errno) {
+	if (config == NULL) {
 		printf("Error: invalid or non-existing configuration file: \"%s\"!\n", config_file);
+		perror(NULL);
 		show_usage(argv[0]);
 		return CELIX_START_ERROR;
 	}



Mime
View raw message