diff options
author | dd <dd@FreeBSD.org> | 2001-06-24 18:21:52 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-06-24 18:21:52 +0000 |
commit | 33eab9da62ba6909d9a9c49f7eb8c67abf9379ab (patch) | |
tree | 936b57764fee716c839a7706004f3bcda8fe123f /sbin | |
parent | 31d2b42b50742f9b1207e4642ce8f7605453aa83 (diff) | |
download | FreeBSD-src-33eab9da62ba6909d9a9c49f7eb8c67abf9379ab.zip FreeBSD-src-33eab9da62ba6909d9a9c49f7eb8c67abf9379ab.tar.gz |
Use strdup(3) instead of reimplementing it inline.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mdmfs/mdmfs.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/sbin/mdmfs/mdmfs.c b/sbin/mdmfs/mdmfs.c index 3b55ed9..003aa80 100644 --- a/sbin/mdmfs/mdmfs.c +++ b/sbin/mdmfs/mdmfs.c @@ -475,25 +475,19 @@ extract_ugid(const char *str, struct mtpt_info *mip) { char *ug; /* Writable 'str'. */ char *user, *group; /* Result of extracton. */ - size_t strl; /* Length of 'str' incl. NULL. */ struct passwd *pw; struct group *gr; char *p; uid_t *uid; gid_t *gid; - size_t rv; uid = &mip->mi_uid; gid = &mip->mi_gid; mip->mi_have_uid = mip->mi_have_gid = false; /* Extract the user and group from 'str'. Format above. */ - strl = strlen(str) + 1; - ug = malloc(strl); + ug = strdup(str); assert(ug != NULL); - rv = strlcpy(ug, str, strl); - if (rv >= strl) - errx(1, "-w word too long (%ld >= %ld)", (long)rv, (long)strl); group = ug; user = strsep(&group, ":"); if (user == NULL || group == NULL || *user == '\0' || *group == '\0') |