diff options
Diffstat (limited to 'samsung-ipc')
-rw-r--r-- | samsung-ipc/utils.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/samsung-ipc/utils.c b/samsung-ipc/utils.c index 3fb4adc..a2ef2bf 100644 --- a/samsung-ipc/utils.c +++ b/samsung-ipc/utils.c @@ -145,6 +145,7 @@ int file_data_write(struct ipc_client *client, const char *path, ipc_client_log(client, "%s failed: chunk_size > size", __func__); } + errno = EINVAL; return -1; } @@ -158,6 +159,7 @@ int file_data_write(struct ipc_client *client, const char *path, seek = lseek(fd, (off_t) offset, SEEK_SET); if (seek < (off_t) offset) { + rc = errno; ipc_client_log(client, "%s failed: seek < (off_t) offset", __func__); goto error; @@ -180,17 +182,17 @@ int file_data_write(struct ipc_client *client, const char *path, count += rc; } - rc = 0; - goto complete; + if (fd >= 0) + close(fd); -error: - rc = -1; + return 0; -complete: +error: if (fd >= 0) close(fd); - return rc; + errno = rc; + return -1; } off_t file_data_size(struct ipc_client *client, const char *path) |