Comment 3 for bug 1720779

Revision history for this message
Colin Ian King (colin-king) wrote :

The following code reproduces the bug:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>

int main(void)
{
        char path[1024];
        int fd;
        const pid_t pid = getpid();
        char buffer[1];

        snprintf(path, sizeof(path), "/proc/%d/task/%d/attr/context", pid, pid);

        fd = open(path, O_RDWR);
        if (fd >= 0) {
                (void)write(fd, buffer, 0);
                (void)close(fd);
        }
}