X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fuilib.c;fp=lib%2Fuilib.c;h=4901966890f48826940837a24c0c77af4c20ef95;hb=4d487bad97fd2efc3192a8042bd53009d96fc42b;hp=c67410ef65243ee604bb9bf391f39150c564ad80;hpb=c0d36fc531b148cfc8ceacc25e5e27d78cdd1906;p=doldaconnect.git diff --git a/lib/uilib.c b/lib/uilib.c index c67410e..4901966 100644 --- a/lib/uilib.c +++ b/lib/uilib.c @@ -49,6 +49,8 @@ #include #include +#define DOLCON_SRV_NAME "_dolcon._tcp" + #define RESP_END -1 #define RESP_DSC 0 #define RESP_STR 1 @@ -858,15 +860,10 @@ static int getsrvrr(char *name, char **host, int *port) return(-1); } /* res_querydomain doesn't work for some reason */ - name2 = smalloc(strlen("_dolcon._tcp.") + strlen(name) + 2); - strcpy(name2, "_dolcon._tcp."); - strcat(name2, name); - len = strlen(name2); - if(name2[len - 1] != '.') - { - name2[len] = '.'; - name2[len + 1] = 0; - } + if(name[strlen(name) - 1] == '.') + name2 = sprintf2("%s.%s", DOLCON_SRV_NAME, name); + else + name2 = sprintf2("%s.%s.", DOLCON_SRV_NAME, name); ret = res_query(name2, C_IN, T_SRV, buf, sizeof(buf)); if(ret < 0) {