dlt-daemon: Only create directories if they do not exist yet #340
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dlt_mkdir_recursive runs mkdir for directories which already exist.
This fails if the directory already exists and the dlt-daemon
does not have the permissions to change the mode on the directory.
On many systems the directories are not created by dlt-daemon
itself but rather through the build system or while the
root filesystem is created.
At this stage the permissions are already set properly
and they might be less permissive than what dlt-daemon expects
but still sufficient.
For example is rwx not necessary for each directory in the tree.
Before this commit the following scenario would fail:
As dlt daemon would try to run mkdir on /mnt
dlt_mkdir_recursive would fail due to lack of permissions
although the permissions are sufficient for dlt-daemon to
work and write its files into /mnt/dlt/
With this commit /mnt would not be created anymore because it
already exists.
If the permissions are not sufficient for dlt-daemon to write in
it will fail when trying to create files and exit at this point
The program was tested solely for our own use cases, which might differ from yours. Licensed under Mozilla Public License Version 2.0
Alexander Mohr, [email protected], Daimler TSS GmbH, imprint