Added error messages.
This commit is contained in:
		
							parent
							
								
									6ed9e9188e
								
							
						
					
					
						commit
						9dce51de18
					
				
							
								
								
									
										4
									
								
								tools.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tools.h
									
									
									
									
									
								
							| @ -41,7 +41,7 @@ char * tool_function_bash(char * command){ | |||||||
|     fp = popen(command, "r"); |     fp = popen(command, "r"); | ||||||
|     if (fp == NULL) { |     if (fp == NULL) { | ||||||
|         perror("popen failed"); |         perror("popen failed"); | ||||||
|         return NULL; |         return "Popen failed!"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Read output in chunks
 |     // Read output in chunks
 | ||||||
| @ -52,7 +52,7 @@ char * tool_function_bash(char * command){ | |||||||
|             perror("realloc failed"); |             perror("realloc failed"); | ||||||
|             free(output); |             free(output); | ||||||
|             pclose(fp); |             pclose(fp); | ||||||
|             return NULL; |             return "Failed to allocate memory!"; | ||||||
|         } |         } | ||||||
|         output = new_output; |         output = new_output; | ||||||
|         strcpy(output + total_size, buffer); |         strcpy(output + total_size, buffer); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user