mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #2687 from ianyfan/swaybar
swaybar: explicitly check return value of getdelim
This commit is contained in:
		
						commit
						480bcda1ee
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
					@ -67,9 +67,13 @@ bool status_handle_readable(struct status_line *status) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wl_list_init(&status->blocks);
 | 
								wl_list_init(&status->blocks);
 | 
				
			||||||
			status->tokener = json_tokener_new();
 | 
								status->tokener = json_tokener_new();
 | 
				
			||||||
			status->buffer_index = getdelim(&status->buffer,
 | 
								read_bytes = getdelim(&status->buffer, &status->buffer_size, EOF, status->read);
 | 
				
			||||||
					&status->buffer_size, EOF, status->read);
 | 
								if (read_bytes > 0) {
 | 
				
			||||||
			return i3bar_handle_readable(status);
 | 
									status->buffer_index = read_bytes;
 | 
				
			||||||
 | 
									return i3bar_handle_readable(status);
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return false;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		wlr_log(WLR_DEBUG, "Using text protocol.");
 | 
							wlr_log(WLR_DEBUG, "Using text protocol.");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue