Lose unnecessary url type checking from fdSize()
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 15 Oct 2009 11:33:45 +0000 (14:33 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 16 Oct 2009 09:54:35 +0000 (12:54 +0300)
- we're only dealing with local files once fd is opened

rpmio/rpmio.c

index 4fb9ece..ca97a22 100644 (file)
@@ -321,22 +321,9 @@ off_t fdSize(FD_t fd)
     struct stat sb;
     off_t rc = -1; 
 
-#ifdef NOISY
-DBGIO(0, (stderr, "==>\tfdSize(%p) rc %ld\n", fd, (long)rc));
-#endif
     FDSANE(fd);
-    switch (fd->urlType) {
-    case URL_IS_PATH:
-    case URL_IS_UNKNOWN:
-       if (fstat(Fileno(fd), &sb) == 0)
-           rc = sb.st_size;
-    case URL_IS_HTTPS:
-    case URL_IS_HTTP:
-    case URL_IS_HKP:
-    case URL_IS_FTP:
-    case URL_IS_DASH:
-       break;
-    }
+    if (fstat(Fileno(fd), &sb) == 0)
+       rc = sb.st_size;
     return rc;
 }