terminal: Only set title if asprintf succeeded

Handles potential out of memory situation by skipping the title update.
This fixes the following warning:

  terminal.c: In function ‘resize_handler’:
  terminal.c:851:11: warning: ignoring return value of ‘asprintf’,
  declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
dev
Bryce W. Harrington 11 years ago committed by Kristian Høgsberg
parent ad0704a226
commit 3abdafd12d
  1. 7
      clients/terminal.c

@ -848,9 +848,10 @@ resize_handler(struct widget *widget,
width = columns * terminal->average_width + m; width = columns * terminal->average_width + m;
height = rows * terminal->extents.height + m; height = rows * terminal->extents.height + m;
widget_set_size(terminal->widget, width, height); widget_set_size(terminal->widget, width, height);
asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows); if (asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows) > 0) {
window_set_title(terminal->window, p); window_set_title(terminal->window, p);
free(p); free(p);
}
} }
terminal_resize_cells(terminal, columns, rows); terminal_resize_cells(terminal, columns, rows);

Loading…
Cancel
Save