Skip to content
This repository has been archived by the owner. It is now read-only.

[dev.icinga.com #2950] remove weird switch() statement when scanning checkresult queue #1065

Closed
icinga-migration opened this issue Aug 5, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@icinga-migration
Copy link
Member

commented Aug 5, 2012

This issue has been migrated from Redmine: https://dev.icinga.com/issues/2950

Created by mfriedrich on 2012-08-05 11:11:52 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2012-08-31 13:42:52 +00:00)
Target Version: 1.8
Last Update: 2012-08-31 13:42:52 +00:00 (in Redmine)

Icinga Version: 1.7.1
OS Version: Debian

the condition only reflects - is a symlink, or is it a real file. if last option matches, process the file further. still, stat(2) won't allow that either, so at least remove the logical bug.

core: Remove weird switch() statement when scanning check result queue
First of all, we use stat(2) instead of lstat(2), so the supposed check
for symlinks is bogus. If it was a symlink, we'd either get ENOENT or
the stat info of the actual file.

It's also wrong to check st.st_mode & S_IFMT against S_IFREG and then
checking it again with the macro S_ISREG(), since they'll both always
evaluate to true.

Instead, we remove the case statement and only use a simple S_ISREG()
and ignore everything but ordinary files.

Signed-off-by: Andreas Ericsson 

Changesets

2012-08-05 11:12:29 +00:00 by mfriedrich 4399b1b48a44d8be2f137a0548e223d5a56de793

core: remove weird switch() statement when scanning checkresult queue #2950

a simple if this does not fit, continue the loop does the trick. in this
it's about checking if the file is "real" and not symlinked. though,
stat(2) does not allow that either, so at least fix the logical bug.

refs #2950

2012-08-07 13:30:23 +00:00 by mfriedrich a3eff50

core: remove weird switch() statement when scanning checkresult queue #2950

a simple if this does not fit, continue the loop does the trick. in this
it's about checking if the file is "real" and not symlinked. though,
stat(2) does not allow that either, so at least fix the logical bug.

refs #2950

2012-08-19 17:41:16 +00:00 by mfriedrich 2ee9cbe

core: remove weird switch() statement when scanning checkresult queue #2950

a simple if this does not fit, continue the loop does the trick. in this
it's about checking if the file is "real" and not symlinked. though,
stat(2) does not allow that either, so at least fix the logical bug.

refs #2950
@icinga-migration

This comment has been minimized.

Copy link
Member Author

commented Aug 31, 2012

Updated by mfriedrich on 2012-08-31 13:42:52 +00:00

  • Status changed from Assigned to Resolved
  • Target Version set to 1.8
  • Done % changed from 0 to 100
  • Icinga Version set to 1
  • OS Version set to Debian
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.