Commit bbee0253 authored by Daniel Black's avatar Daniel Black

MDEV-8743: O_CLOEXEC on innodb/xtradb temp files

Thread 1 "mysqld" hit Breakpoint 1, innobase_mysql_tmpfile () at /home/dan/repos/mariadb-server-5.5/storage/xtradb/handler/ha_innodb.cc:1639
1639            os_event_wait(srv_allow_writes_event);

(gdb) p fd
$2 = 7
(gdb) n
1682                    fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 0);
(gdb)
1687                    if (fd2 < 0) {
(gdb) p fd2
$3 = 8

cat /proc/20448/fdinfo/{7,8}
  2051972      0 -r--------   1  dan      dan             0 Mar  2 12:04 fdinfo/7
pos:    0
flags:  0100002
mnt_id: 82
  2051973      0 -r--------   1  dan      dan             0 Mar  2 12:04 fdinfo/8
pos:    0
flags:  02100002
mnt_id: 82

So fd 8 has 02000000 hence CLOEXEC
parent 88fb8b2e
......@@ -1410,8 +1410,12 @@ innobase_mysql_tmpfile(void)
fd2 = -1;
}
}
#else
#ifdef F_DUPFD_CLOEXEC
fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 0);
#else
fd2 = dup(fd);
#endif
#endif
if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2));
......
......@@ -1677,8 +1677,12 @@ innobase_mysql_tmpfile(void)
fd2 = -1;
}
}
#else
#ifdef F_DUPFD_CLOEXEC
fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 0);
#else
fd2 = dup(fd);
#endif
#endif
if (fd2 < 0) {
DBUG_PRINT("error",("Got error %d on dup",fd2));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment