Skip to content
Snippets Groups Projects
Commit 11db4c50 authored by sof's avatar sof
Browse files

[project @ 1997-11-24 21:21:13 by sof]

If possible, catch error when opening files for writing to a dangling symlink
parent 0cb62f92
No related merge requests found
......@@ -67,7 +67,15 @@ StgByteArray how;
ghc_errtype = ERR_NOSUCHTHING;
ghc_errstr = "file does not exist";
return NULL;
}
} else {
/* If it is a dangling symlink, break off now, too. */
struct stat st;
if ( lstat(file,&st) == 0) {
ghc_errtype = ERR_NOSUCHTHING;
ghc_errstr = "dangling symlink";
return NULL;
}
}
/* Now try to create it */
while ((fd = open(file, oflags | O_CREAT | O_EXCL, 0666)) < 0) {
if (errno == EEXIST) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment