summaryrefslogtreecommitdiff
path: root/lib/falloc.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-10-31 21:38:21 +0000
committerjbj <devnull@localhost>1999-10-31 21:38:21 +0000
commitb57249fd5e6a292a6d6aec9c0ec4b9d2fecb08d1 (patch)
treef0213ec7489dcd0d00a16e1f840f74fc355fbaf1 /lib/falloc.c
parent3d087dcf52531f766af0c503a6cbddfaef84f86a (diff)
downloadlibrpm-tizen-b57249fd5e6a292a6d6aec9c0ec4b9d2fecb08d1.tar.gz
librpm-tizen-b57249fd5e6a292a6d6aec9c0ec4b9d2fecb08d1.tar.bz2
librpm-tizen-b57249fd5e6a292a6d6aec9c0ec4b9d2fecb08d1.zip
Spec: Add rootdir (as in chroot).
parseSpec(): Pass rootdir argument. rpm.c: Rework bigMode enum to simplify per-mode option checks. build/build.c: Attempt a chroot before execl(). falloc.c: thinko: test for non-existent packages database was broke. makeTempFile(): Skip possible URL leader on tempfile name expansion. rpmio.c: Mkdir/Chdir/Rmdir/Rename/Chroot/Unlink syscall wrappers. rpmdb.c: Coalesce and simplify legacy openDatabase() wrappers. uninstall.c: Skip possible URL leader on chroot arg. CVS patchset: 3409 CVS date: 1999/10/31 21:38:21
Diffstat (limited to 'lib/falloc.c')
-rw-r--r--lib/falloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/falloc.c b/lib/falloc.c
index b2796bcfd..7156e6017 100644
--- a/lib/falloc.c
+++ b/lib/falloc.c
@@ -53,7 +53,7 @@ FD_t fadOpen(const char * path, int flags, int perms)
fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
/* is this file brand new? */
- if (fadGetFileSize(fd) < 0) {
+ if (fadGetFileSize(fd) == 0) {
newHdr.magic = FA_MAGIC;
newHdr.firstFree = 0;
if (Fwrite(&newHdr, sizeof(newHdr), 1, fd) != sizeof(newHdr)) {
@@ -256,6 +256,7 @@ unsigned int fadAlloc(FD_t fd, unsigned int size)
header.freePrev = header.freeNext = 0;
/* reserve all space up front */
+ /* XXX TODO: check max. no. of bytes to write */
if (Pwrite(fd, space, size, newBlockOffset) != size)
return 0;
@@ -325,6 +326,7 @@ void fadFree(FD_t fd, unsigned int offset)
header.freePrev = prevFreeOffset;
footer.isFree = 1;
+ /* XXX TODO: set max. no. of bytes to write */
(void)Pwrite(fd, &header, sizeof(header), offset);
(void)Pwrite(fd, &footer, sizeof(footer), footerOffset);
@@ -347,6 +349,7 @@ void fadFree(FD_t fd, unsigned int offset)
faHeader.magic = FA_MAGIC;
faHeader.firstFree = fadGetFirstFree(fd);
+ /* XXX TODO: set max. no. of bytes to write */
if (Pwrite(fd, &faHeader, sizeof(faHeader), 0) != sizeof(faHeader))
return;
}