mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 08:05:59 +01:00
Error out earlier
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
0683b78f9d
commit
48cf3a22e0
1 changed files with 5 additions and 8 deletions
|
@ -542,6 +542,11 @@ prepare_document_open_from_stdin(const char* path)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (infileno == -1) {
|
||||
girara_error("Can not read from file descriptor.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GError* error = NULL;
|
||||
gchar* file = NULL;
|
||||
gint handle = g_file_open_tmp("zathura.stdin.XXXXXX", &file, &error);
|
||||
|
@ -554,14 +559,6 @@ prepare_document_open_from_stdin(const char* path)
|
|||
}
|
||||
|
||||
// read and dump to temporary file
|
||||
if (infileno == -1) {
|
||||
girara_error("Can not read from file descriptor.");
|
||||
close(handle);
|
||||
g_unlink(file);
|
||||
g_free(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char buffer[BUFSIZ];
|
||||
ssize_t count = 0;
|
||||
while ((count = read(infileno, buffer, BUFSIZ)) > 0) {
|
||||
|
|
Loading…
Reference in a new issue