PERFORCE change 82236 for review

soc-tyler soc-tyler at FreeBSD.org
Thu Aug 18 21:14:23 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=82236

Change 82236 by soc-tyler at soc-tyler_launchd on 2005/08/18 21:13:43

	Take out nonsensical debugging stuff, it was breaking launchctl(1).
	
	_lc isn't being calloc()'d somewhere around here, and that's breaking 
	launch_msg() and *everything* (since everything uses it)

Affected files ...

.. //depot/projects/soc2005/launchd/launchctl/launchctl.c#8 edit
.. //depot/projects/soc2005/launchd/liblaunch.c#6 edit

Differences ...

==== //depot/projects/soc2005/launchd/launchctl/launchctl.c#8 (text+ko) ====

@@ -1077,10 +1077,6 @@
 	if (resp == NULL) {
 		fprintf(stderr, "launch_msg(): %s\n", strerror(errno));
 		return 1;
-	} else if (resp = 0x1234) {
-		fprintf(stderr, "launch_msg(): %s\t_lc == NULL: liblaunch.c:690\n", 
-			strerror(errno));
-		return 1;
 	} else if (launch_data_get_type(resp) == LAUNCH_DATA_DICTIONARY) {
 		launch_data_dict_iterate(resp, print_jobs, NULL);
 	} else {

==== //depot/projects/soc2005/launchd/liblaunch.c#6 (text+ko) ====

@@ -125,6 +125,7 @@
 	
 	_lc = calloc(1, sizeof(struct _launch_client));
 
+	// if we can't calloc() _lc, exit function
 	if (_lc == NULL)
 		return;
 
@@ -181,6 +182,8 @@
 	if (_lc)
 		free(_lc);
 	_lc = NULL;
+	
+	fprintf(stderr, "liblaunch.c:launch_client_init():out_bad called\n");
 }
 
 launch_data_t launch_data_alloc(launch_data_type_t t) {
@@ -661,7 +664,7 @@
 {
 	pthread_once(&_lc_once, launch_client_init);
 
-	if (!_lc) {
+	if (_lc == NULL) {
 		errno = ENOTCONN;
 		return -1;
 	}
@@ -689,7 +692,7 @@
 	// we error out and say "Socket not connected" here
 	if (_lc == NULL) {
 		errno = ENOTCONN;
-		return 0x1234;
+		return NULL;
 	}
 
 	pthread_mutex_lock(&_lc->mtx);


More information about the p4-projects mailing list