improve the units-1.88-coverity.patch

Thanks to Adrian Mariano.
This commit is contained in:
Kamil Dudka 2011-11-17 09:18:26 +01:00
parent fdfae8d301
commit f805147fe2
2 changed files with 6 additions and 4 deletions

View File

@ -49,17 +49,16 @@ index cdda76a..c4230c9 100644
if (readerr == E_FILE) {
if (errfile)
fprintf(errfile, "%s: unable to open included file '%s' at line %d of file '%s\n", progname, includefile, linenum, file);
@@ -1381,7 +1384,8 @@ subunitroot(int n,char *in[], char *out[])
@@ -1381,7 +1384,7 @@ subunitroot(int n,char *in[], char *out[])
char **ptr,**current;
int count;
- for(current = in;*current && *current==NULLUNIT;current++);
+ for(current = in;*current==NULLUNIT;current++)
+ if (!*current) return E_NOTROOT;
count = 0;
for(ptr=in;*ptr;ptr++){
if (*ptr==NULLUNIT) continue;
@@ -2618,7 +2622,7 @@ Typing 'search text' will show units whose names contain 'text'.\n\n",
@@ -2618,7 +2621,7 @@ Typing 'search text' will show units whose names contain 'text'.\n\n",
int
main(int argc, char **argv)
{

View File

@ -1,7 +1,7 @@
Summary: A utility for converting amounts from one unit to another
Name: units
Version: 1.88
Release: 4%{?dist}
Release: 5%{?dist}
Source: ftp://ftp.gnu.org/gnu/units/%{name}-%{version}.tar.gz
URL: http://www.gnu.org/software/units/units.html
License: GPLv3+
@ -59,6 +59,9 @@ fi
%{_mandir}/man1/*
%changelog
* Thu Nov 17 2011 Kamil Dudka <kdudka@redhat.com> - 1.88-5
- improve the units-1.88-coverity.patch (thanks to Adrian Mariano)
* Wed Nov 16 2011 Kamil Dudka <kdudka@redhat.com> - 1.88-4
- fix code defects found by Coverity