From 9d2a15e034348a38a569d4ff91047363f608ee79 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 30 Apr 2020 18:24:25 +0800
Subject: [PATCH] update tlv project, fix server program fatal bug

---
 app_ddns/ddns_client.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/app_ddns/ddns_client.c b/app_ddns/ddns_client.c
index ede812a..ff5650d 100644
--- a/app_ddns/ddns_client.c
+++ b/app_ddns/ddns_client.c
@@ -52,10 +52,12 @@
     char              *str;
     int                val;
     char              *domain;
+    char              *id;
     char              *serverip;
     int                port;
     int                i;
     char               key[64];
+    char               msg[512];
 
     struct option long_options[] = { 
         {"conf", required_argument, NULL, 'c'},
@@ -95,12 +97,17 @@
         return -1; 
     }   
 
+    id=iniparser_getstring(ini, "common:id", NULL);
     domain=iniparser_getstring(ini, "common:domain", NULL);
+
     if( !domain )
     {
-        printf("ERROR: cannot parse domain in '%s'\n", conf_file); 
+        printf("ERROR: cannot parse domain/id in '%s'\n", conf_file); 
         return -1; 
     }
+
+    memset(msg, 0, sizeof(msg));
+    snprintf(msg, sizeof(msg), "[%s]: '%s'", id, domain);
 
     for(i=0; i<MAX_HOSTS; i++)
     {
@@ -118,7 +125,7 @@
         }
 
         printf("==> Start send domain '%s' to [%s:%d]\n", domain, serverip, port);
-        socket_send_domain(serverip, port, domain);
+        socket_send_domain(serverip, port, msg);
         printf("\n");
     }
 

--
Gitblit v1.9.1