diff options
Diffstat (limited to 'tools/gdbm_load.c')
-rw-r--r-- | tools/gdbm_load.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/gdbm_load.c b/tools/gdbm_load.c index 5d5e50e..e7e2ab1 100644 --- a/tools/gdbm_load.c +++ b/tools/gdbm_load.c @@ -148,9 +148,10 @@ main (int argc, char **argv) { size_t len; struct passwd *pw; + int delim; len = strcspn (optarg, ".:"); - if (optarg[len]) + if ((delim = optarg[len]) != 0) optarg[len++] = 0; pw = getpwnam (optarg); if (pw) @@ -187,7 +188,7 @@ main (int argc, char **argv) } } } - else + else if (delim) { if (!pw) { @@ -200,6 +201,10 @@ main (int argc, char **argv) } owner_gid = pw->pw_gid; } + else + { + owner_gid = getgid(); + } meta_mask |= GDBM_META_MASK_OWNER; } break; |