summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/sample-photobooth.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/sample-photobooth.c b/examples/sample-photobooth.c
index 43a5bb259..65327152e 100644
--- a/examples/sample-photobooth.c
+++ b/examples/sample-photobooth.c
@@ -44,6 +44,9 @@ capture_to_file(Camera *camera, GPContext *context, char *fn) {
}
fd = open(fn, O_CREAT | O_WRONLY, 0644);
+ if (fd == -1)
+ return GP_ERROR;
+
retval = gp_file_new_from_fd(&file, fd);
if (retval < GP_OK) {
close(fd);