summaryrefslogtreecommitdiff
path: root/gs/psi
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2015-06-19 11:18:32 +0100
committerChris Liddell <chris.liddell@artifex.com>2015-06-19 15:21:39 +0100
commit3adab1a6e20eebc004e032c50f017b176e5b3aeb (patch)
treec9f00c7f1a4065507535c44a9275282fc4dc6dd0 /gs/psi
parentd366dc9568f3bd2da06b57c7b0776b299200861a (diff)
downloadghostpdl-3adab1a6e20eebc004e032c50f017b176e5b3aeb.tar.gz
Coverity: move assignment to before the return
Resetting a pointer to NULL was after the function returned. No cluster differences.
Diffstat (limited to 'gs/psi')
-rw-r--r--gs/psi/zfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gs/psi/zfile.c b/gs/psi/zfile.c
index 24597efc3..121e403e8 100644
--- a/gs/psi/zfile.c
+++ b/gs/psi/zfile.c
@@ -857,11 +857,13 @@ zopen_file(i_ctx_t *i_ctx_p, const gs_parsed_file_name_t *pfn,
const char *file_access, stream **ps, gs_memory_t *mem)
{
gx_io_device *const iodev = pfn->iodev;
+ int code = 0;
if (pfn->fname == NULL) { /* just a device */
iodev->state = i_ctx_p;
- return iodev->procs.open_device(iodev, file_access, ps, mem);
+ code = iodev->procs.open_device(iodev, file_access, ps, mem);
iodev->state = NULL;
+ return code;
}
else { /* file */
iodev_proc_open_file((*open_file)) = iodev->procs.open_file;
@@ -870,7 +872,7 @@ zopen_file(i_ctx_t *i_ctx_p, const gs_parsed_file_name_t *pfn,
open_file = iodev_os_open_file;
/* Check OS files to make sure we allow the type of access */
if (open_file == iodev_os_open_file) {
- int code = check_file_permissions(i_ctx_p, pfn->fname, pfn->len,
+ code = check_file_permissions(i_ctx_p, pfn->fname, pfn->len,
file_access[0] == 'r' ? "PermitFileReading" : "PermitFileWriting");
if (code < 0 && !file_is_tempfile(i_ctx_p,