All pastes #234841 Raw Edit

Something

public text v1 · immutable
·published 2006-11-02 21:07 UTC
rendered paste body
Index: client/File.cpp
===================================================================
--- client/File.cpp	(revision 683)
+++ client/File.cpp	(working copy)
@@ -213,6 +213,12 @@
 	if(mode & TRUNCATE) {

 		m |= O_TRUNC;

 	}

+
+	struct stat s;
+	if(lstat(aFileName.c_str(), &s) != -1) {
+		if(!S_ISREG(s.st_mode) && !S_ISLNK(s.st_mode))
+			throw FileException("Not a regular file or symbolic link");
+	}
 

 	h = open(aFileName.c_str(), m, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);

 	if(h == -1)