chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b854a7e
)
umount: simplify code for deactivating loop devices
author
Lennart Poettering
<lennart@poettering.net>
Wed, 13 Oct 2010 22:43:13 +0000
(
00:43
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 13 Oct 2010 22:43:13 +0000
(
00:43
+0200)
src/umount.c
patch
|
blob
|
history
diff --git
a/src/umount.c
b/src/umount.c
index bd4f01ff64ae553d5cbdef1c77ff0cbf411e3ad6..ff1296fc0f7a77cb125a58fd9bd4805d62850916 100644
(file)
--- a/
src/umount.c
+++ b/
src/umount.c
@@
-271,23
+271,14
@@
finish:
static int delete_loopback(const char *device) {
int fd, r;
static int delete_loopback(const char *device) {
int fd, r;
- if ((fd = open(device, O_RDONLY|O_CLOEXEC)) < 0) {
- if (errno == ENOENT) {
- log_debug("Loop device %s does not exist.", device);
- errno = 0;
- return 0;
- }
+ if ((fd = open(device, O_RDONLY|O_CLOEXEC)) < 0)
return -errno;
return -errno;
- }
- ioctl(fd, LOOP_CLR_FD, 0);
- r = errno;
+ r = ioctl(fd, LOOP_CLR_FD, 0);
close_nointr_nofail(fd);
close_nointr_nofail(fd);
- if (r == ENXIO) /* not bound, so no error */
- r = 0;
- errno = r;
- return -errno;
+ /* ENXIO: not bound, so no error */
+ return (r >= 0 || errno == ENXIO) ? 0 : -errno;
}
static int mount_points_list_umount(MountPoint **mount_point_list_head) {
}
static int mount_points_list_umount(MountPoint **mount_point_list_head) {