Skip to content

Commit

Permalink
Fix loop ownership
Browse files Browse the repository at this point in the history
We changed the symlink ownership instead of the target device.
  • Loading branch information
nirs committed Jul 24, 2019
1 parent 91004a4 commit fda52be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions userstorage/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ def create(self):
raise backend.CreateFailed(
"Error creating loop device: {}".format(e))

if os.geteuid() != 0:
osutil.chown(device)

# Remove stale symlink.
if os.path.islink(self.path):
os.unlink(self.path)

os.symlink(device, self.path)

if os.geteuid() != 0:
osutil.chown(self.path)

def delete(self):
log.info("Removing loop device %s", self.path)
if self.exists():
Expand Down

0 comments on commit fda52be

Please sign in to comment.