[packages/vzquota] - fix time_t confusion on x32 - rel 2

baggins baggins at pld-linux.org
Mon Apr 6 17:35:55 CEST 2015


commit 2f1c203c70cc60f7052c7bbcd549a88e5861cd1e
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Apr 6 15:35:35 2015 +0000

    - fix time_t confusion on x32
    - rel 2

 time_t.patch | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vzquota.spec |   4 +-
 2 files changed, 148 insertions(+), 1 deletion(-)
---
diff --git a/vzquota.spec b/vzquota.spec
index 285ee2f..7ea9201 100644
--- a/vzquota.spec
+++ b/vzquota.spec
@@ -2,12 +2,13 @@ Summary:	Virtuozzo/OpenVZ disk quota control utility
 Summary(pl.UTF-8):	Narzędzie do sterowania limitami dyskowymi Virtuozzo/OpenVZ
 Name:		vzquota
 Version:	3.1
-Release:	1
+Release:	2
 License:	GPL v2+
 Group:		Applications/System
 Source0:	http://download.openvz.org/utils/vzquota/%{version}/src/%{name}-%{version}.tar.bz2
 # Source0-md5:	a3c837999a90381ba028ee73e84f40f2
 Patch0:		vzquota.patch
+Patch1:		time_t.patch
 URL:		http://openvz.org/
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -22,6 +23,7 @@ dyskowymi (quota) dla kontenerów Virtuozzo/OpenVZ.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 %{__make} \
diff --git a/time_t.patch b/time_t.patch
new file mode 100644
index 0000000..9aa81a0
--- /dev/null
+++ b/time_t.patch
@@ -0,0 +1,145 @@
+--- vzquota-3.1/src/common.c~	2012-09-11 00:38:34.000000000 +0000
++++ vzquota-3.1/src/common.c	2015-04-06 15:23:09.566926416 +0000
+@@ -262,10 +262,10 @@
+ 
+ #define ASP_STR_LEN	256
+ 
+-int str2time(char *s, long int *n)
++int str2time(char *s, time_t *n)
+ {
+ 	int len, i, tmp;
+-	long int val = 0;
++	time_t val = 0;
+ 	char c, buf[ASP_STR_LEN], *p, *q;
+ 
+ 	/* check input params */
+@@ -288,7 +288,11 @@
+ 		if (0 == str_isdigit(p)) {
+ 			if (0 == strlen(p))
+ 				return -1;
++#ifdef __ILP32__
++			sscanf(p, "%lld", n);
++#else
+ 			sscanf(p, "%ld", n);
++#endif
+ 			return 0;
+ 		}
+ 
+@@ -337,7 +341,11 @@
+ 				p = gostr(buf);
+ 				if (str_isdigit(p))
+ 					return -1;
++#ifdef __ILP32__
++				sscanf(p, "%lld", &val);
++#else
+ 				sscanf(p, "%ld", &val);
++#endif
+ 				*n = dq_t[i].t * val;
+ 				return 0;
+ 			}
+--- vzquota-3.1/src/stat.c.orig	2012-09-11 00:38:34.000000000 +0000
++++ vzquota-3.1/src/stat.c	2015-04-06 15:30:32.876949719 +0000
+@@ -87,11 +87,19 @@
+ 
+ 	if (batch_mode) {
+ 		/* usage soft hard grace expire */
++#ifdef __ILP32__
++		printf("%14llu %14llu %14llu %14llu %14llu\n",
++#else
+ 		printf("%14llu %14llu %14llu %14lu %14lu\n",
++#endif
+ 		      ker2block(s->bcurrent), ker2block(s->bsoftlimit), ker2block(s->bhardlimit),
+ 		      s->btime, i->bexpire);
+ 		/* usage soft hard grace expire */
++#ifdef __ILP32__
++		printf("%14u %14u %14u %14llu %14llu\n",
++#else
+ 		printf("%14u %14u %14u %14lu %14lu\n",
++#endif
+ 		      s->icurrent, s->isoftlimit, s->ihardlimit,
+ 		      s->itime, i->iexpire);
+ 
+@@ -155,7 +163,11 @@
+ 	}
+ 	for (i = 0; i < MAXQUOTAS; i++) {
+ 		if (batch_mode) {
++#ifdef __ILP32__
++			printf("%5s %lld %lld %9Xh\n",
++#else
+ 			printf("%5s %ld %ld %9Xh\n",
++#endif
+ 			       type2name(i), q->info.ugid_info[i].bexpire,
+ 			       q->info.ugid_info[i].iexpire, q->info.ugid_info[i].flags);
+ 			continue;
+@@ -202,7 +214,11 @@
+ 		/* blocks */
+ 		t = (s->qi_stat.bcurrent < s->qi_stat.bsoftlimit) ? 0 : s->qi_stat.btime;
+ 		if (batch_mode) {
++#ifdef __ILP32__
++			sprintf(buf1, "%lld", t);
++#else
+ 			sprintf(buf1, "%ld", t);
++#endif
+ 		} else {
+ 			difftime2str(t, buf1);
+ 		}
+@@ -216,7 +232,11 @@
+ 		/* inodes */
+ 		t = (s->qi_stat.icurrent < s->qi_stat.isoftlimit) ? 0 : s->qi_stat.itime;
+ 		if (batch_mode) {
++#ifdef __ILP32__
++			sprintf(buf1, "%lld", t);
++#else
+ 			sprintf(buf1, "%ld", t);
++#endif
+ 		} else {
+ 			difftime2str(t, buf1);
+ 		}
+--- vzquota-3.1/src/vzdqdump.c.orig	2015-04-06 15:31:21.686952284 +0000
++++ vzquota-3.1/src/vzdqdump.c	2015-04-06 15:33:45.843626529 +0000
+@@ -112,7 +112,11 @@
+ 	if (option & FL_DUMP_GRACE) {
+ 		printf("#%s\ttype\tblock\tinode\n", GRACE_LABEL);
+ 		for (i = 0; i < MAXQUOTAS; i++) {
++#ifdef __ILP32__
++			printf("%s\t%u\t%llu\t%llu\n",
++#else
+ 			printf("%s\t%u\t%lu\t%lu\n",
++#endif
+ 				GRACE_LABEL,
+ 				i,
+ 				q->info.ugid_info[i].bexpire,
+@@ -158,7 +162,11 @@
+ 
+ 				/* exp times */
+ 				if (option & FL_DUMP_EXPTIME)
++#ifdef __ILP32__
++					printf("\t%llu\t%llu",
++#else
+ 					printf("\t%lu\t%lu",
++#endif
+ 						(s->qi_stat.bcurrent < s->qi_stat.bsoftlimit) ?
+ 							0 : s->qi_stat.btime,
+ 						(s->qi_stat.icurrent < s->qi_stat.isoftlimit) ?
+@@ -176,13 +184,21 @@
+ 		printf(FIRST_LEVEL_LABEL "\n");
+ 
+ 		/* usage soft hard grace expire */
++#ifdef __ILP32__
++		printf("%llu %llu %llu %llu %llu\n",
++#else
+ 		printf("%llu %llu %llu %lu %lu\n",
++#endif
+ 		      stat->dq_stat.bcurrent, stat->dq_stat.bsoftlimit,
+ 		      stat->dq_stat.bhardlimit, stat->dq_stat.btime,
+ 		      stat->dq_info.bexpire);
+ 
+ 		/* usage soft hard grace expire */
++#ifdef __ILP32__
++		printf("%u %u %u %llu %llu\n",
++#else
+ 		printf("%u %u %u %lu %lu\n",
++#endif
+ 		      stat->dq_stat.icurrent, stat->dq_stat.isoftlimit,
+ 		      stat->dq_stat.ihardlimit, stat->dq_stat.itime,
+ 		      stat->dq_info.iexpire);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vzquota.git/commitdiff/2f1c203c70cc60f7052c7bbcd549a88e5861cd1e



More information about the pld-cvs-commit mailing list