fix(server.c): add newline only if there isn't one already
This commit is contained in:
		
							parent
							
								
									8764f00655
								
							
						
					
					
						commit
						fdd0d73e77
					
				
					 3 changed files with 8 additions and 5 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| # feuille version
 | ||||
| VERSION = 1.19.3 | ||||
| VERSION = 1.19.4 | ||||
| 
 | ||||
| # paths (customize them to fit your system)
 | ||||
| PREFIX = /usr/local | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| . ftr VB CB | ||||
| . ftr VBI CBI | ||||
| .\} | ||||
| .TH "feuille" "1" "November 2022" "feuille 1.19.3" "" | ||||
| .TH "feuille" "1" "November 2022" "feuille 1.19.4" "" | ||||
| .hy | ||||
| .SH NAME | ||||
| .PP | ||||
|  |  | |||
							
								
								
									
										9
									
								
								server.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								server.c
									
										
									
									
									
								
							|  | @ -227,11 +227,14 @@ unsigned long read_paste(int connection, char **output) | |||
|         return 0; | ||||
|     } | ||||
| 
 | ||||
|     /* end the buffer with a newline */ | ||||
|     buffer[total_size] = '\n'; | ||||
|     /* end the buffer with a newline if there's none */ | ||||
|     if (buffer[total_size - 1] != '\n') { | ||||
|         buffer[total_size]      = '\n'; | ||||
|         total_size++; /* add newline to total size */ | ||||
|     } | ||||
| 
 | ||||
|     *output = buffer; | ||||
|     return total_size + 1; /* newline */ | ||||
|     return total_size; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  |  | |||
		Reference in a new issue
	
	 Tom MTT
						Tom MTT