ptserver: Don't ignore ubik_Write failures
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 19 Feb 2013 15:43:29 +0000 (15:43 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 22 Feb 2013 14:16:45 +0000 (06:16 -0800)
If we can't write to the ubik database, then that's a bad thing.
Don't ignore it.

Caught by clang-analyzer

Change-Id: I08b57a74405cc563c6141251fd3d433b2904ea0e
Reviewed-on: http://gerrit.openafs.org/9176
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/ptserver/ptutils.c
src/ptserver/utils.c

index 144d07a..b877694 100644 (file)
@@ -445,6 +445,8 @@ CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid, af
 
        /* write updated entry for group */
        code = pr_Write(at, 0, pos, &centry, sizeof(centry));
+       if (code)
+           return PRDBFAIL;
 
        /* Now add the new user entry to the database */
        tentry.creator = creator;
index 732f585..60de047 100644 (file)
@@ -479,6 +479,8 @@ RemoveFromIDHash(struct ubik_trans *tt, afs_int32 aid, afs_int32 *loc)              /* ??? i
            return PRDBFAIL;
        bentry.nextID = tentry.nextID;
        code = pr_WriteEntry(tt, 0, trail, &bentry);
+       if (code)
+           return PRDBFAIL;
     }
     *loc = current;
     return PRSUCCESS;
@@ -557,6 +559,8 @@ RemoveFromNameHash(struct ubik_trans *tt, char *aname, afs_int32 *loc)
            return PRDBFAIL;
        bentry.nextName = tentry.nextName;
        code = pr_WriteEntry(tt, 0, trail, &bentry);
+       if (code)
+           return PRDBFAIL;
     }
     *loc = current;
     return PRSUCCESS;