diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-01-08 18:15:54 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-01-12 11:29:16 +0100 |
commit | ec945f352178470d39aa0f7c407fc4ae859b34b0 (patch) | |
tree | 3b2606105b25494cb4b0f141afc1c5d474360ea8 /include | |
parent | 818d180da1c709f3d2789925662222019b3cf439 (diff) | |
download | barebox-ec945f352178470d39aa0f7c407fc4ae859b34b0.tar.gz barebox-ec945f352178470d39aa0f7c407fc4ae859b34b0.tar.xz |
fs: implement pushd/popd chdir wrappers
We don't have dirfd's, so running operations relative to the current
working directory always involves some allocation/freeing boilerplate.
Add pushd/popd helpers to move the boilerplate out of the callsites.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220108171555.588426-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/unistd.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h index 06ce355809..f7fe737d00 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -20,6 +20,8 @@ int rmdir (const char *pathname); int symlink(const char *pathname, const char *newpath); int readlink(const char *path, char *buf, size_t bufsiz); int chdir(const char *pathname); +char *pushd(const char *dir); +int popd(char *dir); const char *getcwd(void); int ftruncate(int fd, loff_t length); |