From 0e827f194796b48ed570ad4f97d5286feceecd2e Mon Sep 17 00:00:00 2001 From: sgerwk Date: Tue, 7 Sep 2021 14:03:38 +0200 Subject: [PATCH] check whether g_rename succeds --- src/bt-obex.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bt-obex.c b/src/bt-obex.c index 8aacb40..4d4370e 100644 --- a/src/bt-obex.c +++ b/src/bt-obex.c @@ -175,9 +175,15 @@ static void _obex_server_properties_handler(GDBusConnection *connection, const g } else if(g_strcmp0(status, "complete") == 0) { + int res; + char *src, *dst; g_print("[OBEX Server] Transfer succeeded\n"); ObexTransferInfo *info = g_hash_table_lookup(_transfer_infos, object_path); - g_rename(g_build_filename(info->obex_root, info->filename, NULL), g_build_filename(_root_path, info->filename, NULL)); + src = g_build_filename(info->obex_root, info->filename, NULL); + dst = g_build_filename(_root_path, info->filename, NULL); + res = g_rename(src, dst); + if (res) + printf("[OBEX Server] Error: cannot rename %s to %s\n", src, dst); } else if(g_strcmp0(status, "error") == 0) {