summaryrefslogtreecommitdiff
path: root/lib/fs.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-06-22 18:51:56 +0000
committerjbj <devnull@localhost>2002-06-22 18:51:56 +0000
commit05cb73a7ee762065339393057d421613866e0418 (patch)
tree533b7192c83e882aab90c337d4356735932de7f0 /lib/fs.c
parentba41c1ccb13a7a27466470e501a0d4f30fddec40 (diff)
downloadlibrpm-tizen-05cb73a7ee762065339393057d421613866e0418.tar.gz
librpm-tizen-05cb73a7ee762065339393057d421613866e0418.tar.bz2
librpm-tizen-05cb73a7ee762065339393057d421613866e0418.zip
Factor bounds checking annotations into source code.
CVS patchset: 5521 CVS date: 2002/06/22 18:51:56
Diffstat (limited to 'lib/fs.c')
-rw-r--r--lib/fs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/fs.c b/lib/fs.c
index a1e0f5d6b..0a5fcbbe1 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -1,3 +1,4 @@
+/*@-boundsread@*/
/*@-mods@*/
/**
* \file lib/fs.c
@@ -27,8 +28,10 @@ void freeFilesystems(void)
{
if (filesystems) {
int i;
+/*@-boundswrite@*/
for (i = 0; i < numFilesystems; i++)
filesystems[i].mntPoint = _free(filesystems[i].mntPoint);
+/*@=boundswrite@*/
filesystems = _free(filesystems);
}
if (fsnames) {
@@ -219,10 +222,12 @@ static int getFilesystemList(void)
filesystems[numFilesystems].mntPoint = NULL;
filesystems[numFilesystems].rdonly = 0;
+/*@-boundswrite@*/
fsnames = xcalloc((numFilesystems + 1), sizeof(*fsnames));
for (i = 0; i < numFilesystems; i++)
fsnames[i] = filesystems[i].mntPoint;
fsnames[numFilesystems] = NULL;
+/*@=boundswrite@*/
return 0;
}
@@ -234,8 +239,10 @@ int rpmGetFilesystemList(const char *** listptr, int * num)
if (getFilesystemList())
return 1;
+/*@-boundswrite@*/
if (listptr) *listptr = fsnames;
if (num) *num = numFilesystems;
+/*@=boundswrite@*/
return 0;
}
@@ -268,6 +275,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
if (maxLen < len) maxLen = len;
}
+/*@-boundswrite@*/
buf = alloca(maxLen + 1);
lastDir = alloca(maxLen + 1);
dirName = alloca(maxLen + 1);
@@ -330,17 +338,21 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
strcpy(lastDir, buf);
usages[lastfs] += fssizes[i];
}
+/*@=boundswrite@*/
sourceDir = _free(sourceDir);
+/*@-boundswrite@*/
/*@-branchstate@*/
if (usagesPtr)
*usagesPtr = usages;
else
usages = _free(usages);
/*@=branchstate@*/
+/*@=boundswrite@*/
return 0;
}
/*@=usereleased =onlytrans@*/
/*@=mods@*/
+/*@=boundsread@*/