diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2017-04-05 22:40:52 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2017-04-05 22:40:52 +0200 |
commit | 51517d52ccbdb1c69ee08a77b119a53fc31177fa (patch) | |
tree | 8f8306a86959af575a9c22fb4fda3f524ff9fbd8 | |
parent | 7076ea6522c0f9557663b2a461c6e951b6764c15 (diff) | |
download | libgphoto2-51517d52ccbdb1c69ee08a77b119a53fc31177fa.tar.gz |
avoid error on capture return no image
-rw-r--r-- | camlibs/pentax/library.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/camlibs/pentax/library.c b/camlibs/pentax/library.c index 4e3bbff40..b18e1a0b8 100644 --- a/camlibs/pentax/library.c +++ b/camlibs/pentax/library.c @@ -269,7 +269,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, int bufno, i; const char *mimes[2]; int buftypes[2], jpegres[2], nrofdownloads = 1; - char *fns[2]; + char *fns[2], *lastfn = NULL; gp_log (GP_LOG_DEBUG, "pentax", "camera_capture"); @@ -292,7 +292,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, mimes[1] = GP_MIME_JPEG; sprintf (path->name, "capt%04d.jpg", capcnt); fns[1] = strdup(path->name); - camera->pl->lastfn = strdup (fns[1]); + lastfn = strdup (fns[1]); nrofdownloads = 2; /* FALLTHROUGH */ case PSLR_IMAGE_FORMAT_RAW: @@ -319,11 +319,12 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, gp_log (GP_LOG_ERROR, "pentax", "unknown format image=0x%x (raw=0x%x)", status.image_format, status.raw_format); return GP_ERROR; } - /* get status again */ + /* get status again, also waits until not busy */ pslr_get_status (p, &status); if (status.bufmask == 0) { gp_log (GP_LOG_ERROR, "pentax", "no buffer available for download"); + free (lastfn); return GP_ERROR; } for (bufno=0;bufno<16;bufno++) @@ -371,6 +372,7 @@ camera_capture (Camera *camera, CameraCaptureType type, CameraFilePath *path, ret = gp_filesystem_set_info_noop(camera->fs, path->folder, fns[i], info, context); free (fns[i]); } + camera->pl->lastfn = lastfn; pslr_delete_buffer(p, bufno ); pslr_get_status (&camera->pl->pslr, &status); /* wait until busy is gone */ |