Comment 2 for bug 865082

Revision history for this message
Roman Yepishev (rye) wrote :

src/vtestream-file.h:

static inline void
_vte_file_stream_ensure_fd0 (VteFileStream *stream)
{
        gint fd;
        gchar *file_name;
        if (G_LIKELY (stream->fd[0]))
                return;

        fd = g_file_open_tmp ("vteXXXXXX", &file_name, NULL);
        if (fd != -1) {
                unlink (file_name);
                g_free (file_name);
        }

        stream->fd[0] = dup (fd); /* we do the dup to make sure ->fd[0] is not 0 */

        close (fd);
}