diff -r edd9b0fa63ca -r 66ec30bde5e5 librazor/root.c --- a/librazor/root.c Mon Jan 12 17:54:13 2009 +0000 +++ b/librazor/root.c Sat May 09 21:30:22 2009 +0100 @@ -275,14 +275,22 @@ RAZOR_EXPORT int razor_root_commit(struct razor_root *root) { + int retval; assert (root != NULL); /* Make it so. */ - rename(root->new_path, root->path); - printf("renamed %s to %s\n", root->new_path, root->path); + close(root->fd); +#ifdef MSWIN_API + /* Rename is not atomic under MS-Windows */ + remove(root->path); +#endif + retval = rename(root->new_path, root->path); + if (retval) + perror(root->path); + else + printf("renamed %s to %s\n", root->new_path, root->path); razor_set_destroy(root->system); - close(root->fd); free(root); - return 0; + return retval; }