[RTEMS 5 PATCH 1/3] libmisc/shell/chmod: Fix multiple file arguments to the command
From: Chris Johns Closes #4558 --- cpukit/libmisc/shell/main_chmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpukit/libmisc/shell/main_chmod.c b/cpukit/libmisc/shell/main_chmod.c index 0c39072f6b..288fd52f4c 100644 --- a/cpukit/libmisc/shell/main_chmod.c +++ b/cpukit/libmisc/shell/main_chmod.c @@ -53,7 +53,7 @@ static int rtems_shell_main_chmod( * Now change the files modes */ for (n=2 ; n < argc ; n++) -chmod(argv[n++], mode); +chmod(argv[n], mode); return 0; } -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS 5 PATCH 3/3] libmisc/shell/edit: Return if no memory in move_gap
From: Chris Johns Closes #4565 --- cpukit/libmisc/shell/main_edit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index 586f33bd93..681e8c5f3c 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -407,6 +407,9 @@ static void move_gap(struct editor *ed, int pos, int minsize) { if (gapsize + MINEXTEND > minsize) minsize = gapsize + MINEXTEND; newsize = (ed->end - ed->start) - gapsize + minsize; start = (unsigned char *) malloc(newsize); // TODO check for out of memory +if (start == NULL) { +return; +} gap = start + pos; rest = gap + minsize; end = start + newsize; -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS 5 PATCH 2/3] libmisc/shell/edit: Fix closing the editor
From: Chris Johns Closes #4564 --- cpukit/libmisc/shell/main_edit.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index e43ff68d2b..586f33bd93 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -1789,14 +1789,14 @@ static void save_editor(struct editor *ed) { ed->refresh = 1; } -static void close_editor(struct editor *ed) { +static struct editor* close_editor(struct editor *ed) { struct env *env = ed->env; if (ed->dirty) { display_message(ed, "Close %s without saving changes (y/n)? ", ed->filename); if (!ask()) { ed->refresh = 1; - return; + return ed; } } @@ -1808,6 +1808,7 @@ static void close_editor(struct editor *ed) { new_file(ed, ""); } ed->refresh = 1; + return ed; } static void pipe_command(struct editor *ed) { @@ -2131,15 +2132,7 @@ static void edit(struct editor *ed) { case ctrl('s'): save_editor(ed); break; case ctrl('p'): pipe_command(ed); break; #endif -#if defined(__rtems__) -/* - * Coverity spotted this as using ed after free() so changing - * the order of the statements. - */ -case ctrl('w'): ed = ed->env->current; close_editor(ed); break; -#else -case ctrl('w'): close_editor(ed); ed = ed->env->current; break; -#endif +case ctrl('w'): ed = close_editor(ed); break; } } } -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 1/2] libmisc/shell/edit: Fix closing the editor
From: Chris Johns Closes #4834 --- cpukit/libmisc/shell/main_edit.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index 191eefa19d..b9e377bc23 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -1809,14 +1809,14 @@ static void save_editor(struct editor *ed) { ed->refresh = 1; } -static void close_editor(struct editor *ed) { +static struct editor* close_editor(struct editor *ed) { struct env *env = ed->env; if (ed->dirty) { display_message(ed, "Close %s without saving changes (y/n)? ", ed->filename); if (!ask()) { ed->refresh = 1; - return; + return ed; } } @@ -1828,6 +1828,7 @@ static void close_editor(struct editor *ed) { new_file(ed, ""); } ed->refresh = 1; + return ed; } static void pipe_command(struct editor *ed) { @@ -2151,15 +2152,7 @@ static void edit(struct editor *ed) { case ctrl('s'): save_editor(ed); break; case ctrl('p'): pipe_command(ed); break; #endif -#if defined(__rtems__) -/* - * Coverity spotted this as using ed after free() so changing - * the order of the statements. - */ -case ctrl('w'): ed = ed->env->current; close_editor(ed); break; -#else -case ctrl('w'): close_editor(ed); ed = ed->env->current; break; -#endif +case ctrl('w'): ed = close_editor(ed); break; } } } -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/2] libmisc/shell/edit: Return if no memory in move_gap
From: Chris Johns Closes #4835 --- cpukit/libmisc/shell/main_edit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index b9e377bc23..6e954639e2 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -412,6 +412,9 @@ static void move_gap(struct editor *ed, int pos, int minsize) { if (gapsize + MINEXTEND > minsize) minsize = gapsize + MINEXTEND; newsize = (ed->end - ed->start) - gapsize + minsize; start = (unsigned char *) malloc(newsize); // TODO check for out of memory +if (start == NULL) { +return; +} gap = start + pos; rest = gap + minsize; end = start + newsize; -- 2.37.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel