From 306172f60020c97064cc194492e28f86efc30f8d Mon Sep 17 00:00:00 2001 From: ewt Date: Tue, 6 Jan 1998 03:20:24 +0000 Subject: [PATCH] 0 length files are bad only if the files are regular ones -- it may be fine for sockets CVS patchset: 1916 CVS date: 1998/01/06 03:20:24 --- CHANGES | 1 + lib/package.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 3c6b197..6b97f24 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ - fixed error messages displayed when opening the database fails during package installation and removal - query format of the form '[A%{}]' would drop the static string + - fixed fix in 2.4.9 for empty packages which broke -qip on ftp URL's 2.4.10 -> 2.4.11: - HAVE_SYS_SOCKET_H was mistakingly MACHINE_SYS_SOCKET_H in diff --git a/lib/package.c b/lib/package.c index 9e288dc..bde14bd 100644 --- a/lib/package.c +++ b/lib/package.c @@ -41,7 +41,8 @@ static int readPackageHeaders(int fd, struct rpmlead * leadPtr, oldLead = (struct oldrpmlead *) lead; fstat(fd, &sb); - if (sb.st_size < 4) return 1; + /* if fd points to a socket, pipe, etc, sb.st_size is *always* zero */ + if (S_ISREG(sb.st_mode) && sb.st_size < 4) return 1; if (readLead(fd, lead)) { return 2; -- 2.7.4