Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. Index: lib/System/Unix/Path.inc
  2. ===================================================================
  3. --- lib/System/Unix/Path.inc (revision 89338)
  4. +++ lib/System/Unix/Path.inc (working copy)
  5. @@ -454,6 +454,27 @@
  6. }
  7.  
  8. bool
  9. +Path::isSpecial() const {
  10. + // Get the status so we can determin if its a file or directory
  11. + struct stat buf;
  12. + if (0 != stat(path.c_str(), &buf)) {
  13. + MakeErrMsg(ErrStr, path + ": can't get status of file");
  14. + return true;
  15. + }
  16. +
  17. + // Check catches strange situations. In all cases, LLVM should
  18. + // only be involved in the creation and deletion of regular files. This
  19. + // check ensures that what we're trying to work only on a regular file. It
  20. + // effectively prevents LLVM from erasing things like /dev/null, any block
  21. + // special file, or other things that aren't "regular" files.
  22. + if ( S_ISDIR(buf.st_mode) || S_ISREG(buf.st_mode) ) {
  23. + return false;
  24. + }
  25. +
  26. + return true;
  27. +}
  28. +
  29. +bool
  30. Path::canExecute() const {
  31. if (0 != access(path.c_str(), R_OK | X_OK ))
  32. return false;
Add Comment
Please, Sign In to add comment