home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / minix / 4804 < prev    next >
Encoding:
Text File  |  1992-11-18  |  1.4 KB  |  47 lines

  1. Newsgroups: comp.os.minix
  2. Path: sparky!uunet!mcsun!sun4nl!relay.philips.nl!philce!meulenbr
  3. From: meulenbr@ce.philips.nl (Frans Meulenbroeks)
  4. Subject: Re: Bug in fs Minix1.6.23
  5. Message-ID: <1992Nov19.081218.25559@philce.ce.philips.nl>
  6. Sender: usenet@philce.ce.philips.nl (USENET post news)
  7. Organization: Philips Consumer Electronics, Eindhoven
  8. References: <flebbe.722116609@wega>
  9. Date: Thu, 19 Nov 1992 08:12:18 GMT
  10. Lines: 35
  11.  
  12. flebbe@wega.tat.physik.uni-tuebingen.de (Olaf Flebbe) writes:
  13.  
  14. >Hi,
  15.  
  16. >I discovered a bug in the 1.6.23 fs, while using test21. Here a quote
  17. >from source of do_rename() in fs/link.c
  18.  
  19. >do_rename() {
  20. >[...]
  21. >  struct inode *old_dirp, *old_ip;    /* ptrs to old dir, file inodes */
  22. >[ ...]
  23. >  if ( (old_ip = advance(old_dirp, old_name)) == NIL_INODE) r = err_code;
  24. >[ ... (no return statements) ...]
  25. >  odir = ((old_ip->i_mode & I_TYPE) == I_DIRECTORY);  /* TRUE iff dir */
  26.  
  27. >The source describes how to get a pointer to the inode of file
  28. >old_name and how to test, whether it is a directory. But suppose
  29. >advance fails, then advance will return a NIL_INODE, which fs tries to
  30. >derefence. ->Crash. 
  31.  
  32. [...]
  33.  
  34. >Is there already a "official" patch around?
  35.  
  36. Yes. add:
  37.   if (old_ip != NIL_INODE)
  38. before the line
  39.     odir = ((old_ip->i_mode & I_TYPE) == I_DIRECTORY);  /* TRUE iff dir */
  40.  
  41. This will be part of the next version.
  42.  
  43. Enjoy,
  44. --
  45. Frans Meulenbroeks        Philips Research Laboratories
  46. preferred email address:     meulenbr@prl.philips.nl
  47.