Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open resolve links #47

Merged
merged 5 commits into from
Mar 6, 2024
Merged

Conversation

fischerling
Copy link
Contributor

As mentioned in #40, I think symbolic links are only useful if they need no manual resolution.

This PR resolves all symbolic links in vfs_open.

All additional changes are requirements or simplifications.

On my Linux system opening "/proc" with out any flags works just fine.
Additionally this restriction prevents using resolve_path on the
virtual proc file system.

The following code snippets works without an error on Linux.

	#include <err.h>
	#include <fcntl.h>
	#include <stdlib.h>

	int main() {
		int fd = open("/proc", 0, 0);
		if (fd < 0) {
			err(EXIT_FAILURE, "opening /proc failed\n");
		}

		return 0;
	}
Symbolic links are much more usefull if we do not have to take
care of them maually.
Use resolve_path and FOLLOW_LINKS when opening files using vfs_open.

Additionally, the directory check is not needed because calling
read(2) on a directory should return -1 and set errno to EISDIR.
@Galfurian Galfurian merged commit d123c56 into mentos-team:develop Mar 6, 2024
18 checks passed
@fischerling fischerling deleted the open-resolve-links branch March 14, 2024 17:49
@Galfurian Galfurian added the enhancement New feature or request label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants