Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
942bb395
Commit
942bb395
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
startup: don't crash when opening standard input would fail
This fixes
https://savannah.gnu.org/bugs/?51206
.
parent
52b7a41e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nano.c
+9
-3
src/nano.c
with
9 additions
and
3 deletions
+9
-3
src/nano.c
View file @
942bb395
...
...
@@ -1145,8 +1145,14 @@ void stdin_pager(void)
/* Open standard input. */
stream
=
fopen
(
"/dev/stdin"
,
"rb"
);
if
(
stream
==
NULL
)
nperror
(
"fopen"
);
if
(
stream
==
NULL
)
{
int
errnumber
=
errno
;
terminal_init
();
doupdate
();
statusline
(
ALERT
,
_
(
"Failed to open stdin: %s"
),
strerror
(
errnumber
));
return
;
}
/* Read the input into a new buffer. */
open_buffer
(
""
,
FALSE
);
...
...
@@ -1167,6 +1173,7 @@ void stdin_pager(void)
terminal_init
();
doupdate
();
set_modified
();
}
/* Register half a dozen signal handlers. */
...
...
@@ -2528,7 +2535,6 @@ int main(int argc, char **argv)
/* If one of the arguments is a dash, read text from standard input. */
if
(
optind
<
argc
&&
!
strcmp
(
argv
[
optind
],
"-"
))
{
stdin_pager
();
set_modified
();
optind
++
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment