Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Factor out free of previous owner/group
Antoine Brodin committed 11 years ago
commit 7da83f5fdd2b79cc441559ed595c31e027f652b2
parent 727a52f
1 file changed +8 -14
modified libpkg/pkg_ports.c
@@ -460,15 +460,12 @@ setmod(struct plist *p, char *line, struct file_attr *a)
static int
setowner(struct plist *p, char *line, struct file_attr *a)
{
-
	if (line[0] == '\0') {
-
		if (p->uname != NULL)
-
			free(p->uname);
+
	if (p->uname != NULL)
+
		free(p->uname);
+
	if (line[0] == '\0')
		p->uname = strdup("root");
-
	} else {
-
		if (p->uname != NULL)
-
			free(p->uname);
+
	else
		p->uname = strdup(line);
-
	}

	free_file_attr(a);

@@ -478,15 +475,12 @@ setowner(struct plist *p, char *line, struct file_attr *a)
static int
setgroup(struct plist *p, char *line, struct file_attr *a)
{
-
	if (line[0] == '\0') {
-
		if (p->gname != NULL)
-
			free(p->gname);
+
	if (p->gname != NULL)
+
		free(p->gname);
+
	if (line[0] == '\0')
		p->gname = strdup("wheel");
-
	} else {
-
		if (p->gname != NULL)
-
			free(p->gname);
+
	else
		p->gname = strdup(line);
-
	}

	free_file_attr(a);