summaryrefslogtreecommitdiff
path: root/lib/verify.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-05-03 15:02:42 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-05-03 15:02:42 +0300
commit469b10d1d2d9819e0793fac7f84ae2cfa75135d9 (patch)
tree71e88521bfd66ead032bc777baa1ab0f16412b78 /lib/verify.c
parenta039c48f95ebd30ab6674c47c2c96460a32774aa (diff)
downloadrpm-469b10d1d2d9819e0793fac7f84ae2cfa75135d9.tar.gz
rpm-469b10d1d2d9819e0793fac7f84ae2cfa75135d9.tar.bz2
rpm-469b10d1d2d9819e0793fac7f84ae2cfa75135d9.zip
Clean up file type verification logic a bit
- Non-regular files mostly share the same unverifiable properties, no point in listing all the cases separately. Links are a notable exception in that they're different from everything else, handle that separately. - Also clean up other formatting: wrap lines at a better point + avoid multiline-comments when single line suffices.
Diffstat (limited to 'lib/verify.c')
-rw-r--r--lib/verify.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/lib/verify.c b/lib/verify.c
index 46210bc41..8c8d1026e 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -95,38 +95,23 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
return 1;
}
- /*
- * Not all attributes of non-regular files can be verified.
- */
- if (S_ISDIR(sb.st_mode))
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_LINKTO | RPMVERIFY_CAPS);
- else if (S_ISLNK(sb.st_mode)) {
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_MODE | RPMVERIFY_CAPS);
- }
- else if (S_ISFIFO(sb.st_mode))
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_LINKTO | RPMVERIFY_CAPS);
- else if (S_ISCHR(sb.st_mode))
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_LINKTO | RPMVERIFY_CAPS);
- else if (S_ISBLK(sb.st_mode))
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_LINKTO | RPMVERIFY_CAPS);
- else
+ /* Links have no mode, other types have no linkto */
+ if (S_ISLNK(sb.st_mode))
+ flags &= ~(RPMVERIFY_MODE);
+ else
flags &= ~(RPMVERIFY_LINKTO);
- /*
- * Content checks of %ghost files are meaningless.
- */
+ /* Not all attributes of non-regular files can be verified */
+ if (!S_ISREG(sb.st_mode))
+ flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE |
+ RPMVERIFY_MTIME | RPMVERIFY_CAPS);
+
+ /* Content checks of %ghost files are meaningless. */
if (fileAttrs & RPMFILE_GHOST)
- flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
- RPMVERIFY_LINKTO);
+ flags &= ~(RPMVERIFY_FILEDIGEST | RPMVERIFY_FILESIZE |
+ RPMVERIFY_MTIME | RPMVERIFY_LINKTO);
- /*
- * Don't verify any features in omitMask.
- */
+ /* Don't verify any features in omitMask. */
flags &= ~(omitMask | RPMVERIFY_FAILURES);