From: Elan Ruusamäe Date: Sat, 23 Apr 2016 15:11:36 +0000 (+0300) Subject: actually do run second stat() X-Git-Tag: auto/th/net-snmp-5.7.3-10~1 X-Git-Url: https://git.pld-linux.org/?a=commitdiff_plain;h=55e362193b4da510f46a236709c4ba0361c2fc9a;p=packages%2Fnet-snmp.git actually do run second stat() --- diff --git a/net-snmp.spec b/net-snmp.spec index 2714e82..b20ef33 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -444,7 +444,7 @@ SNMP dla trzech wersji tego protokołu (SNMPv3, SNMPv2c, SNMPv1). %patch5 -p1 %patch6 -p1 %patch7 -p1 - +%patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 diff --git a/swinst_apt.patch b/swinst_apt.patch index 7a15757..7c87245 100644 --- a/swinst_apt.patch +++ b/swinst_apt.patch @@ -56,14 +56,14 @@ Signed-Off-By: Elan Ruusamäe + char arch[SNMP_MAXBUF]; char status[SNMP_MAXBUF]; char buf[BUFSIZ]; -+ struct stat stat_buf; ++ struct stat stat_buf; netsnmp_swinst_entry *entry; + u_char *date_buf; + size_t date_len; int i = 0; if (p == NULL) { -@@ -78,20 +86,37 @@ +@@ -78,20 +86,39 @@ continue; /* error already logged by function */ CONTAINER_INSERT(container, entry); @@ -92,9 +92,11 @@ Signed-Off-By: Elan Ruusamäe + } else { + /* somewhy some files include :arch in .list name */ + snprintf(file, sizeof(file), "%s/%s:%s.list", pkg_directory, package, arch); -+ date_buf = date_n_time(&stat_buf.st_mtime, &date_len); -+ entry->swDate_len = date_len; -+ memcpy(entry->swDate, date_buf, entry->swDate_len); ++ if(stat(file, &stat_buf) != -1) { ++ date_buf = date_n_time(&stat_buf.st_mtime, &date_len); ++ entry->swDate_len = date_len; ++ memcpy(entry->swDate, date_buf, entry->swDate_len); ++ } + } + /* FIXME, or fallback to whatever nonsesnse was here before, or leave it uninitialied? + else {