Backport from trunk
2018-09-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* io/unix.c (fallback_access): Avoid calling close on
uninitialized file descriptor.
From-SVN: r264384
+2018-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from trunk
+ 2018-09-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * io/unix.c (fallback_access): Avoid calling close on
+ uninitialized file descriptor.
+
2018-06-22 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
{
int fd;
- if ((mode & R_OK) && (fd = open (path, O_RDONLY)) < 0)
- return -1;
- close (fd);
+ if (mode & R_OK)
+ {
+ if ((fd = open (path, O_RDONLY)) < 0)
+ return -1;
+ else
+ close (fd);
+ }
- if ((mode & W_OK) && (fd = open (path, O_WRONLY)) < 0)
- return -1;
- close (fd);
+ if (mode & W_OK)
+ {
+ if ((fd = open (path, O_WRONLY)) < 0)
+ return -1;
+ else
+ close (fd);
+ }
if (mode == F_OK)
{