From 6c0fd8aa601a21a2bdcadbe72832f16b953d2755 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Wed, 16 Oct 2013 14:57:07 +0400 Subject: [PATCH] [PROTO] Add appname into msg_binary_info reply Change-Id: I5cf1dc37a1c7fae98dd9ae3e95cd63156d2f61a5 --- daemon/da_protocol.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/daemon/da_protocol.c b/daemon/da_protocol.c index 94f6f51..12780ab 100644 --- a/daemon/da_protocol.c +++ b/daemon/da_protocol.c @@ -861,13 +861,24 @@ static void get_file_md5sum(md5_byte_t digest[16], const char *filename) close(fd); } +static const char* basename(const char *filename) +{ + const char *p = strrchr(filename, '/'); + return p ? p + 1 : NULL; +} static struct binary_ack* binary_ack_alloc(const char *filename) { struct binary_ack *ba = malloc(sizeof(*ba)); + char builddir[PATH_MAX]; char binpath[PATH_MAX]; + ba->type = get_binary_type(filename); - get_build_dir(binpath, filename); + get_build_dir(builddir, filename); + + snprintf(binpath, sizeof(binpath), "%s/%s", + builddir, basename(filename) ?: ""); + ba->binpath = strdup(binpath); get_file_md5sum(ba->digest, filename); -- 2.7.4