Skip to content

Commit ab1c093

Browse files
committed
shared/misc: open svcdir dirfd after update_needed
otherwise /run/openrc might not exist, and result on svcdirfd being -1 Fixes: #888
1 parent 863a555 commit ab1c093

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/shared/misc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,13 @@ RC_DEPTREE * _rc_deptree_load(int force, int *regen)
395395
int merrno;
396396
time_t t;
397397
char file[PATH_MAX];
398-
int svcdirfd = rc_dirfd(RC_DIR_SVCDIR);
399398
struct stat st;
400399
FILE *fp;
401400

402401
t = 0;
403402
if (rc_deptree_update_needed(&t, file) || force != 0) {
403+
int svcdirfd = rc_dirfd(RC_DIR_SVCDIR);
404+
404405
/* Test if we have permission to update the deptree */
405406
fd = openat(svcdirfd, "deptree", O_WRONLY);
406407
merrno = errno;

0 commit comments

Comments
 (0)