@@ -420,8 +420,11 @@ static void obc_transfer_free(struct obc_transfer *transfer)
if (transfer->op == G_OBEX_OP_GET &&
transfer->status != TRANSFER_STATUS_COMPLETE &&
- transfer->filename)
- remove(transfer->filename);
+ transfer->filename) {
+ if (remove(transfer->filename) < 0)
+ error("remove(%s): %s(%d)", transfer->filename,
+ strerror(errno), errno);
+ }
if (transfer->fd > 0)
close(transfer->fd);
@@ -521,7 +524,10 @@ static gboolean transfer_open(struct obc_transfer *transfer, int flags,
}
if (transfer->filename == NULL) {
- remove(filename); /* remove always only if NULL was given */
+ /* remove always only if NULL was given */
+ if (remove(filename) < 0)
+ error("remove(%s): %s(%d)", filename, strerror(errno),
+ errno);
g_free(filename);
} else {
g_free(transfer->filename);
@@ -219,7 +219,9 @@ static void pcsuite_disconnect(struct obex_session *os, void *user_data)
close(pcsuite->fd);
if (pcsuite->lock_file) {
- remove(pcsuite->lock_file);
+ if (remove(pcsuite->lock_file) < 0)
+ error("remove(%s): %s(%d)", pcsuite->lock_file,
+ strerror(errno), errno);
g_free(pcsuite->lock_file);
}
@@ -270,7 +270,9 @@ int main(int argc, char *argv[])
if (option_root == NULL) {
option_root = g_build_filename(g_get_user_cache_dir(), "obexd",
NULL);
- g_mkdir_with_parents(option_root, 0700);
+ if (g_mkdir_with_parents(option_root, 0700) < 0)
+ error("Failed to create dir(%d): %s", errno,
+ option_root);
}
if (option_root[0] != '/') {
From: Tedd Ho-Jeong An <tedd.an@intel.com> This patch fixes the unchecked return value(CWE-252) issues reported by the Coverity. --- obexd/client/transfer.c | 12 +++++++++--- obexd/plugins/pcsuite.c | 4 +++- obexd/src/main.c | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-)