Fix some crashers in a prefix with few services.
This commit is contained in:
		
							
								
								
									
										10
									
								
								src/rc/rc.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rc/rc.c
									
									
									
									
									
								
							| @@ -1145,9 +1145,13 @@ int main(int argc, char **argv) | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if (coldplugged_services) | 		if (coldplugged_services) { | ||||||
| 			TAILQ_FOREACH(service, coldplugged_services, entries) | 			if (start_services) { | ||||||
| 				rc_stringlist_addu(start_services, service->value); | 				TAILQ_FOREACH(service, coldplugged_services, entries) | ||||||
|  | 					rc_stringlist_addu(start_services, service->value); | ||||||
|  | 			} else | ||||||
|  | 				start_services = coldplugged_services; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Save our softlevel now */ | 	/* Save our softlevel now */ | ||||||
|   | |||||||
| @@ -1255,12 +1255,13 @@ int runscript(int argc, char **argv) | |||||||
| 						      runlevel, depoptions); | 						      runlevel, depoptions); | ||||||
| 			rc_stringlist_free(tmplist); | 			rc_stringlist_free(tmplist); | ||||||
| 			tmplist = NULL; | 			tmplist = NULL; | ||||||
| 			TAILQ_FOREACH(svc, services, entries) | 			if (services) { | ||||||
| 				printf("%s ", svc->value); | 				TAILQ_FOREACH(svc, services, entries) | ||||||
| 			if (TAILQ_FIRST(services)) | 					printf("%s ", svc->value); | ||||||
| 				printf ("\n"); | 				printf ("\n"); | ||||||
| 			rc_stringlist_free(services); | 				rc_stringlist_free(services); | ||||||
| 			services = NULL; | 				services = NULL; | ||||||
|  | 			} | ||||||
| 		} else if (strcmp (optarg, "status") == 0) { | 		} else if (strcmp (optarg, "status") == 0) { | ||||||
| 			RC_SERVICE r = svc_status(); | 			RC_SERVICE r = svc_status(); | ||||||
| 			retval = (int) r; | 			retval = (int) r; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user