Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Make @owner/@group without an arg set back to default root/wheel as previously documented
Antoine Brodin committed 11 years ago
commit 727a52ff695feb2f06f11a880dbc30110a9d5e35
parent 69744f4
2 files changed +14 -6
modified docs/pkg-create.8
@@ -389,9 +389,13 @@ permissions.
.It Cm @owner Ar user
Set default ownership for all subsequent files to
.Ar user .
+
Use without an arg to set back to default (root)
+
ownership.
.It Cm @group Ar group
Set default group ownership for all subsequent files to
.Ar group .
+
Use without an arg to set back to default (wheel)
+
group ownership.
.It Cm @comment Ar string
The line will be ignored when packing
.It Cm @dirrm Ar name
modified libpkg/pkg_ports.c
@@ -463,9 +463,8 @@ setowner(struct plist *p, char *line, struct file_attr *a)
	if (line[0] == '\0') {
		if (p->uname != NULL)
			free(p->uname);
-
		p->uname = NULL;
-
	}
-
	else {
+
		p->uname = strdup("root");
+
	} else {
		if (p->uname != NULL)
			free(p->uname);
		p->uname = strdup(line);
@@ -479,10 +478,15 @@ 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')
-
		p->gname = NULL;
-
	else
+
	if (line[0] == '\0') {
+
		if (p->gname != NULL)
+
			free(p->gname);
+
		p->gname = strdup("wheel");
+
	} else {
+
		if (p->gname != NULL)
+
			free(p->gname);
		p->gname = strdup(line);
+
	}

	free_file_attr(a);