loop-util: tweak codepath when a loopback file is "created" from an existing block device

Be more careful with initialized of the 'relinquished' boolean field,
and let's return the fd, like we do for the regular codepath, too.
This commit is contained in:
Lennart Poettering 2018-12-31 17:00:10 +01:00
parent 26c1be0fdc
commit 16420be1fd
1 changed files with 2 additions and 2 deletions

View File

@ -45,11 +45,11 @@ int loop_device_make(int fd, int open_flags, LoopDevice **ret) {
*d = (LoopDevice) {
.fd = copy,
.nr = -1,
.relinquished = true, /* It's not allocated by us, don't destroy it when this object is freed */
};
*ret = d;
return 0;
return d->fd;
}
r = stat_verify_regular(&st);