Advertisement
Guest User

chmodtouch

a guest
Apr 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include "type.h"
  2.  
  3. void mychmod(char *pathname, char * param)
  4. {
  5. int ino = getino(dev, pathname);
  6.  
  7. MINODE* mip = iget(dev, ino);
  8. INODE* ip = &mip->INODE;
  9.  
  10. long int new_mode = strtol(param, NULL, 8);
  11.  
  12. ip->i_mode = (ip->i_mode & 0xF000) | new_mode;
  13. mip->dirty=1;
  14.  
  15. iput(mip);
  16. printf("Mode changed\n");
  17.  
  18. }
  19.  
  20. /*
  21. Add Chown if we get to lvl3
  22. */
  23.  
  24. void mytouch(char *pathname)
  25. {
  26. int ino = getino(fd, pathname);
  27. MINODE *mip = iget(fd, ino);
  28. printf("Target file touched.\n");
  29. mip->INODE.i_atime = mip->INODE.i_mtime = time(0L);
  30. mip->dirty = 1;
  31. iput(mip);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement