Merge pull request #31411 from poettering/build-path
userdbd,homed,importd,sysupdate,pid1: make it easier to run daemons that have callouts from build dir
This commit is contained in:
@@ -51,6 +51,7 @@ simple_tests += files(
|
||||
'test-bitmap.c',
|
||||
'test-blockdev-util.c',
|
||||
'test-bootspec.c',
|
||||
'test-build-path.c',
|
||||
'test-bus-util.c',
|
||||
'test-calendarspec.c',
|
||||
'test-cgroup-setup.c',
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
|
||||
#include "build-path.h"
|
||||
#include "log.h"
|
||||
#include "string-util.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
|
||||
r = get_build_exec_dir(&p);
|
||||
if (r == -ENOEXEC)
|
||||
log_info("Not run from build dir.");
|
||||
else if (r < 0)
|
||||
log_error_errno(r, "Failed to find build dir: %m");
|
||||
else
|
||||
log_info("%s", strna(p));
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user