summaryrefslogtreecommitdiffstats
path: root/src/account
diff options
context:
space:
mode:
authorRobin Hack <rhack@redhat.com>2014-02-27 14:16:08 +0100
committerRobin Hack <rhack@redhat.com>2014-03-05 09:58:15 +0100
commit8c0e0bf7af61493d069a99bab123d99a16942371 (patch)
tree1bdd2912470d82b44ee7f70eb86600d53896f121 /src/account
parentf74d14f80a890ba2954be1c1ac3af9e1b8a64800 (diff)
downloadopenlmi-providers-8c0e0bf7af61493d069a99bab123d99a16942371.tar.gz
openlmi-providers-8c0e0bf7af61493d069a99bab123d99a16942371.tar.xz
openlmi-providers-8c0e0bf7af61493d069a99bab123d99a16942371.zip
Account: Try to make coverity happy.
Fix nonsense if statement in indication_common.c.
Diffstat (limited to 'src/account')
-rw-r--r--src/account/indication_common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/account/indication_common.c b/src/account/indication_common.c
index d999176..d9629b4 100644
--- a/src/account/indication_common.c
+++ b/src/account/indication_common.c
@@ -104,15 +104,15 @@ void watcher_destroy(AccountIndication *ind)
bool watcher(AccountIndication *ind, void **data)
{
struct timespec curr_pwd, curr_grp;
- char buffer[BUF_LEN];
char errbuf[STRERROR_BUF_LEN];
if (ind->inotify_fd < 0)
return false;
+ char buffer[BUF_LEN];
do {
- int len = 0, i = 0;
- if ((len = read(ind->inotify_fd, buffer, BUF_LEN)) < 0 || len > (int) BUF_LEN) {
+ const int len = read(ind->inotify_fd, buffer, BUF_LEN);
+ if (len < 0) {
warn("account watcher: error reading from inotify fd: %s", strerror_r(errno, errbuf, sizeof(errbuf)));
watcher_destroy(ind);
watcher_init(ind);
@@ -124,6 +124,8 @@ bool watcher(AccountIndication *ind, void **data)
watcher_init(ind);
return true;
}
+
+ int i = 0;
while (i + (ssize_t) EVENT_SIZE < len) {
struct inotify_event *event = (struct inotify_event *) &buffer[i];
if (i + (ssize_t) EVENT_SIZE + event->len > len) {