1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Program that atomically exchanges two paths using
4 * the renameat2() system call RENAME_EXCHANGE flag.
6 * Copyright 2022 Red Hat Inc.
15 void print_usage(const char *program)
17 printf("Usage: %s [oldpath] [newpath]\n", program);
18 printf("Atomically exchange oldpath and newpath\n");
21 int main(int argc, char *argv[])
30 ret = renameat2(AT_FDCWD, argv[1], AT_FDCWD, argv[2], RENAME_EXCHANGE);
32 perror("rename exchange failed");