1f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj 2f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj/* The bug that gave rise to this is 3f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj https://bugs.kde.org/show_bug.cgi?id=307103 4f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj*/ 5f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj 6f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj#define _GNU_SOURCE 7f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj#include <fcntl.h> 8f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj#include <unistd.h> 9f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardjint main (void) 10f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj{ 11f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj int dfd = open ("/tmp", O_RDONLY); 12e593275d41859efb73a2d0c7fc88473000f52c53sewardj __attribute__((unused)) int fd1 = openat (dfd, "abc", O_RDONLY); 13f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj /* This is fine, absolute path. */ 14e593275d41859efb73a2d0c7fc88473000f52c53sewardj __attribute__((unused)) int fd2 = openat (0x12345678, "/tmp/abc", O_RDONLY); 15e593275d41859efb73a2d0c7fc88473000f52c53sewardj __attribute__((unused)) int fd3 = openat (AT_FDCWD, "abc", O_RDONLY); 16f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj /* This is the only one that should warn. */ 17e593275d41859efb73a2d0c7fc88473000f52c53sewardj __attribute__((unused)) int fd4 = openat (0x12345678, "abc", O_RDONLY); 18f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj return 0; 19f73de269a2424ec83a2fe4b0d8a02167261e1b70sewardj} 20