1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-24 20:10:42 +01:00

cleanup: remove broken stat ... open pattern

confused deputy is confused.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-18 19:26:42 +01:00
parent 11053ebe6a
commit 065d3b678d
2 changed files with 4 additions and 16 deletions

View file

@ -10,9 +10,8 @@
static service_t *try_load(const char *directory, const char *filename) static service_t *try_load(const char *directory, const char *filename)
{ {
int dirfd, type;
struct stat sb;
service_t *svc; service_t *svc;
int dirfd;
dirfd = open(directory, O_RDONLY | O_DIRECTORY); dirfd = open(directory, O_RDONLY | O_DIRECTORY);
@ -21,18 +20,6 @@ static service_t *try_load(const char *directory, const char *filename)
return NULL; return NULL;
} }
if (fstatat(dirfd, filename, &sb, AT_SYMLINK_NOFOLLOW)) {
fprintf(stderr, "stat %s/%s: %s\n",
directory, filename, strerror(errno));
close(dirfd);
return NULL;
}
type = (sb.st_mode & S_IFMT);
if (type != S_IFREG && type != S_IFLNK)
return NULL;
svc = rdsvc(dirfd, filename, 0); svc = rdsvc(dirfd, filename, 0);
close(dirfd); close(dirfd);
return svc; return svc;

View file

@ -39,9 +39,10 @@ the desired service instance.
Parse a service file from and produce a pseudo shell script containing the Parse a service file from and produce a pseudo shell script containing the
exact commands executed when starting the service. exact commands executed when starting the service.
.TP .TP
.BR status .BR status " " \fI[--detail|-d]\fP " " \fI[services...]\fP
Print a status report of all supervised services, i.e. if they are currently Print a status report of all supervised services, i.e. if they are currently
running, have exited or waiting to be scheduled. running, have exited or waiting to be scheduled. A specific list of services
can be specified. Shell globbing patterns can be used.
.SH AVAILABILITY .SH AVAILABILITY
This program is part of the Pygos init system. This program is part of the Pygos init system.
.SH COPYRIGHT .SH COPYRIGHT