diff options
author | 2000-06-18 22:26:56 +0000 | |
---|---|---|
committer | 2000-06-18 22:26:56 +0000 | |
commit | 9c4a30d9c8b6ac64fc223bd0d200a4eb29bc98db (patch) | |
tree | 1548370116acbe55d28f262aee3d6ffa2182e0a1 | |
parent | strlcpy (diff) | |
download | wireguard-openbsd-9c4a30d9c8b6ac64fc223bd0d200a4eb29bc98db.tar.xz wireguard-openbsd-9c4a30d9c8b6ac64fc223bd0d200a4eb29bc98db.zip |
more verbose errors, remove redundant free()s
-rw-r--r-- | usr.bin/tcfs/tcfs_dbmaint.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/tcfs/tcfs_dbmaint.c b/usr.bin/tcfs/tcfs_dbmaint.c index 3d4f30db5af..b7b0004a223 100644 --- a/usr.bin/tcfs/tcfs_dbmaint.c +++ b/usr.bin/tcfs/tcfs_dbmaint.c @@ -219,7 +219,6 @@ tcfs_getpwnam (char *user, tcfspwdb **dest) memcpy (*dest, r.data, sizeof (tcfspwdb)); pdb->close (pdb); - free (r.data); return (tcfspwdb *)*dest; } @@ -255,7 +254,6 @@ tcfs_ggetpwnam (char *user, gid_t gid, tcfsgpwdb **dest) memcpy (*dest, r.data, sizeof (tcfsgpwdb)); pdb->close (pdb); - free (key); return (*dest); } @@ -265,7 +263,7 @@ tcfs_putpwnam (char *user, tcfspwdb *src, int flags) { DB *pdb; static DBT srchkey, d; - int open_flag=0, owf=0; + int open_flag = 0, res; open_flag = O_RDWR|O_EXCL; if (access (TCFSPWDB, F_OK) < 0) @@ -276,7 +274,7 @@ tcfs_putpwnam (char *user, tcfspwdb *src, int flags) return 0; srchkey.data = user; - srchkey.size=(int)strlen (user); + srchkey.size = (int)strlen (user); if (flags != U_DEL) { d.data = (char *)src; @@ -287,8 +285,9 @@ tcfs_putpwnam (char *user, tcfspwdb *src, int flags) pdb->close (pdb); return 0; } - } else if (pdb->del (pdb, &srchkey, 0)) { - fprintf(stderr, "db: del failed\n"); + } else if ((res = pdb->del (pdb, &srchkey, 0))) { + fprintf(stderr, "db: del failed: %s\n", + res == -1 ? "error" : "not found"); pdb->close (pdb); return 0; } @@ -302,7 +301,7 @@ tcfs_gputpwnam (char *user, tcfsgpwdb *src, int flags) { DB *pdb; static DBT srchkey, d; - int open_flag = 0, owf = 0; + int open_flag = 0; char *key, *buf; char *tmp; |