summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2023-05-27 10:03:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2023-05-27 10:03:22 +0000
commitae59230f5043ef659d7eac48e67b2c196cbf3ac1 (patch)
tree8027a342aa577c2a87e2a3395e8999d1afdbd6f2 /usr.sbin/pkg_add
parent4d745b9d5224dd5618a3331ffe86e05f35c76fa3 (diff)
a few comments
explicitly return undef from check, which will prevent casual me from 'fixing' it later
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 4f2deb771f7..317914015dc 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.285 2023/05/16 14:28:39 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.286 2023/05/27 10:03:21 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -1048,6 +1048,8 @@ sub keyword() { "localbase" }
__PACKAGE__->register_with_factory;
sub category() { "localbase" }
+# meta-info: where the package was downloaded/installed from
+# (TODO not as useful as could be, because the workflow isn't effective!)
package OpenBSD::PackingElement::Url;
our @ISA=qw(OpenBSD::PackingElement::Unique);
@@ -1055,7 +1057,7 @@ sub keyword() { "url" }
__PACKAGE__->register_with_factory;
sub category() { "url" }
-# XXX don't incorporate this in signatures.
+# don't incorporate this in signatures for obvious reasons
sub write_no_sig()
{
}
@@ -1235,12 +1237,17 @@ sub destate
$state->{owners}{$self->{name}} = $uid;
}
+# $self->check:
+# 3 possible results
+# - undef: nothing to check, user/group was not there
+# - 0: does not match
+# - 1: exists and matches
sub check
{
my $self = shift;
my ($name, $passwd, $uid, $gid, $quota, $class, $gcos, $dir, $shell,
$expire) = getpwnam($self->name);
- return unless defined $name;
+ return undef unless defined $name;
if ($self->{uid} =~ m/^\!(.*)$/o) {
return 0 unless $uid == $1;
}
@@ -1302,7 +1309,7 @@ sub check
{
my $self = shift;
my ($name, $passwd, $gid, $members) = getgrnam($self->name);
- return unless defined $name;
+ return undef unless defined $name;
if ($self->{gid} =~ m/^\!(.*)$/o) {
return 0 unless $gid == $1;
}