Created
July 31, 2012 19:13
-
-
Save hashar/3219650 to your computer and use it in GitHub Desktop.
move a file and crash gluster!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
int main() { | |
puts( "Writing file 'ORIG_HEAD.lock'!" ); | |
FILE *file; | |
file = fopen( "ORIG_HEAD.lock", "w+" ); | |
fprintf( file, "some string\n" ); | |
fclose( file ); | |
puts( "Renaming file to 'ORIG_HEAD'" ); | |
int rename_result=0; | |
rename_result = rename( "ORIG_HEAD.lock", "ORIG_HEAD" ); | |
if( rename_result < 0 ) { | |
printf( "Error: %s\n", strerror( errno ) ); | |
return -1; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment