1.
结果:
patch = /home/gdu_update/vision/vision0-1.patch ,md51 = bdf910d968c0e17c14670bea8f95471a,GDUmdbuf = 50f57a09527a9586ee33e137cb65ba86,type = 3 - (update_cmp:update_cmp.c:353)
2022-03-15.10:56:22.905010 DEBUG - update exec step 1,rate 0, res 0
------------
dzlog_debug("md5 path:%s\n", chksum);
//
md5 path:md5sum /home/gdu_update/vision/vision0-1.patch
-----------
dzlog_debug("\nMD5 finished %s\n", md5res); // 已经完了
童工的 启发 :
---------
可以直接写一个 md5 的 校验
----------
给路径 我就返回md5的值;
----------------
int MD5Chk(const char *path, char *md5res)
{
FILE *fMD5ResFp;// wjian 1
char chksum[256] = {0};
char tmp[256] = {0};
char res[256] = {0};
// strcpy(chksum, "md5sum /home/gdu_update/2--3.patch"); // 把md5sum 复制到 chksum , 这是命令
strcpy(chksum,"md5sum ");
strcat(chksum,path); // 追加
dzlog_debug();
}
继续 扩展:
int showDateZone(char *timeZoneRes)
{
FILE *fZone5ResFp;
char timeZone[256] = {0};
char tmp[256] = {0};
char res[256] = {0};
strcpy(timeZone,"date -R");
//
//strcat(timeZone, path); //追加
//
dzlog_debug("date -R:%s\n", timeZone);
if (NULL == (fZone5ResFp = popen(timeZone, "r")))
{
printf("execute command error\n"); // 过来的命令为空 ,则输出execute command error
}
dzlog_debug("date -R start\n");
// 比较 余下 空间 和 传来的
//读流
while (NULL != fgets(tmp, sizeof(tmp), fZone5ResFp))
{
int len = strlen(tmp);
strncat(res, tmp, sizeof(res) - 1 - strlen(res) >= len ? len : sizeof(res) - 1 - strlen(res));
}
// 关闭流
pclose(fZone5ResFp);
char *p; //
if ((p = strstr(res, " ")) != NULL)
{
*p = '\0';
strcpy(timeZoneRes, res); // 读到res 放到 timeZoneRes
}
dzlog_debug("\ndate -R finished %s\n", timeZoneRes); // 已经完了
return 0;
}
---------
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:LMHpwWlSsnaGyZpMeZw3u1XmlZqQv1NAKGehS64VR6E.
Please contact your system administrator.
Add correct host key in /home/zc/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/zc/.ssh/known_hosts:7
remove with:
ssh-keygen -f "/home/zc/.ssh/known_hosts" -R 172.16.64.215
ECDSA host key for 172.16.64.215 has changed and you have requested strict checking.
Host key verification failed.
lost connection
-------------
授时的 时间数据的 组成格式
settimeofday 能够设置时区吗