mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
c96afe9caa
Make sure rename across project boundaries is rejected and doesn't cause hangs. Based on a report and testcase from Arkadiusz Miskiewicz. Signed-off-by: Christoph Hellwig <hch@lst.de>
22 lines
320 B
C
22 lines
320 B
C
/*
|
|
* A trivial shell command wrapping rename(2).
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc != 3) {
|
|
fprintf(stderr, "usage: rename <from> <to>\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
if (rename(argv[1], argv[2]) == -1) {
|
|
perror("rename");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
exit(0);
|
|
}
|