[patch]: rare segmentation violation in user menu



Hello, Pavel!

Apply these patches, please.

Thanks!

-- 
Regards,
Andrew V. Samoilov.
ChangeLog:

* user.c (execute_menu_command: Fix rare segmentation violation
if last line in menu file contain space(s) only and no trailing
newline.

--- user.c~	Fri Sep  5 11:23:33 2003
+++ user.c	Mon Sep  8 13:07:51 2003
@@ -578,6 +578,8 @@ execute_menu_command (WEdit *edit_widget
 		break;
 	    while (*commands == ' ' || *commands == '\t')
 	        commands++;
+	    if (*commands == 0)
+		break;
 	}
 	col++;
 	if (*commands == '\n')
* view.c (view_init): Constify "_command" argument.
(view): Likewise.
(do_view_init): Likewise.
(init_growing_view): Constify "name" and "filename" args.

* view.h: Fix declarations and comment.

--- view.h~	Wed Aug 13 18:06:21 2003
+++ view.h	Tue Sep  2 23:14:55 2003
@@ -6,15 +6,15 @@
 
 /* Creation/initialization of a new view widget */
 WView *view_new (int y, int x, int cols, int lines, int is_panel);
-int view_init (WView *view, char *_command, const char *_file,
+int view_init (WView *view, const char *_command, const char *_file,
 	       int start_line);
 
 void view_update_bytes_per_line (WView *view);
 
-/* Command: view a file, if _command != NULL we use popen on _command */
-/* move direction should be apointer that will hold the direction in which the user */
-/* wants to move (-1 previous file, 1 next file, 0 do nothing) */
-int view (char *_command, const char *_file, int *move_direction,
+/* Command: view a _file, if _command != NULL we use popen on _command */
+/* move direction should be a pointer that will hold the direction in which */
+/* the user wants to move (-1 previous file, 1 next file, 0 do nothing) */
+int view (const char *_command, const char *_file, int *move_direction,
 	  int start_line);
 
 extern int mouse_move_pages_viewer;
--- view.c~	Mon Sep  1 12:14:49 2003
+++ view.c	Tue Sep  2 23:14:03 2003
@@ -516,7 +516,7 @@ set_view_init_error (WView *view, const 
 
 /* return values: NULL for success, else points to error message */
 static char *
-init_growing_view (WView *view, char *name, char *filename)
+init_growing_view (WView *view, const char *name, const char *filename)
 {
     char *err_msg = NULL;
 
@@ -605,7 +605,7 @@ load_view_file (WView *view, int fd)
 
 /* Return zero on success, -1 on failure */
 static int
-do_view_init (WView *view, char *_command, const char *_file,
+do_view_init (WView *view, const char *_command, const char *_file,
 	      int start_line)
 {
     char *error = 0;
@@ -758,7 +758,7 @@ view_update_bytes_per_line (WView *view)
 /* Both views */
 /* Return zero on success, -1 on failure */
 int
-view_init (WView *view, char *_command, const char *_file, int start_line)
+view_init (WView *view, const char *_command, const char *_file, int start_line)
 {
     if (!view->view_active || strcmp (_file, view->filename)
 	|| altered_magic_flag)
@@ -2621,7 +2621,7 @@ view_dialog_callback (Dlg_head *h, int i
 
 /* Real view only */
 int
-view (char *_command, const char *_file, int *move_dir_p, int start_line)
+view (const char *_command, const char *_file, int *move_dir_p, int start_line)
 {
     int error;
     WView *wview;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]