Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Package registering should be done only by root
Marin Atanasov Nikolov committed 15 years ago
commit 6c805f9fac79c9f9827420f4a58fef7265ce9281
parent a1cadbc
1 file changed +7 -0
modified pkg/register.c
@@ -1,10 +1,12 @@
#include <sys/stat.h>
+
#include <sys/types.h>
#include <sys/param.h>

#include <err.h>
#include <stdio.h>
#include <pkg.h>
#include <string.h>
+
#include <sysexits.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -61,6 +63,11 @@ exec_register(int argc, char **argv)
	int retcode = 0;
	int ret = 0;

+
	if (geteuid() != 0) {
+
		warnx("registering packages can only be done as root");
+
		return (EX_NOPERM);
+
	}
+

	pkg_new(&pkg);
	while ((ch = getopt(argc, argv, "vHc:d:f:p:P:m:o:C:n:M:s:a:r:w:O:")) != -1) {
		switch (ch) {