home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cvs1107.zip / patches.os2 < prev    next >
Text File  |  2000-01-13  |  3KB  |  84 lines

  1. --- emx\config.h.orig    Wed Dec 31 03:03:16 1997
  2. +++ emx\config.h    Tue Jan 11 11:03:50 2000
  3. @@ -312,5 +312,3 @@ extern int os2_fnmatch(const char *patte
  4.  /* See above; we can't use rsh without -b.  */
  5.  #define RSH_NOT_TRANSPARENT 1
  6.  
  7. -/* See discussion at xchmod in filesubr.c.  */
  8. -#define CHMOD_BROKEN 1
  9. --- emx\filesubr.c.orig    Thu Apr  9 10:19:44 1998
  10. +++ emx\filesubr.c    Tue Jan 11 11:20:36 2000
  11. @@ -307,20 +307,15 @@ mkdir_if_needed (name)
  12.  /*
  13.   * Change the mode of a file, either adding write permissions, or removing
  14.   * all write permissions.  Either change honors the current umask setting.
  15. - * The EMX doc (0.9c, emxlib.doc) says that chmod sets/clears the readonly
  16. - * bit.  But it always seemed to be a noop when I tried it.  Therefore,
  17. - * I've copied over the "attrib" code from os2/filesubr.c.
  18. + * The EMX doc (0.9d, emxlib.doc) says that chmod sets/clears the readonly
  19. + * bit.  It does works and won't leave ugly stuff on screen if using 4OS2
  20.   */
  21.  void
  22.  xchmod (fname, writable)
  23.      char *fname;
  24.      int writable;
  25.  {
  26. -    char *attrib_cmd;
  27. -    char *attrib_option;
  28. -    char *whole_cmd;
  29. -    char *p;
  30. -    char *q;
  31. +    int mode;
  32.  
  33.      if (!isfile (fname))
  34.      {
  35. @@ -329,38 +324,20 @@ xchmod (fname, writable)
  36.      return;
  37.      }
  38.  
  39. -    attrib_cmd = "attrib "; /* No, really? */
  40. -
  41.      if (writable)
  42. -        attrib_option = "-r ";  /* make writeable */
  43. +        mode = S_IWRITE|S_IREAD;                          /* make writeable*/
  44.      else
  45. -        attrib_option = "+r ";  /* make read-only */
  46. +        mode = S_IREAD;                                   /* make read-only*/
  47.          
  48. -    whole_cmd = xmalloc (strlen (attrib_cmd)
  49. -                         + strlen (attrib_option)
  50. -                         + strlen (fname)
  51. -                         + 1);
  52. -
  53. -    strcpy (whole_cmd, attrib_cmd);
  54. -    strcat (whole_cmd, attrib_option);
  55. -
  56. -    /* Copy fname to the end of whole_cmd, translating / to \.
  57. -       Attrib doesn't take / but many parts of CVS rely
  58. -       on being able to use it.  */
  59. -    p = whole_cmd + strlen (whole_cmd);
  60. -    q = fname;
  61. -    while (*q)
  62. -    {
  63. -    if (*q == '/')
  64. -        *p++ = '\\';
  65. -    else
  66. -        *p++ = *q;
  67. -    ++q;
  68. -    }
  69. -    *p = '\0';
  70. +    if (trace)
  71. +        (void) fprintf (stderr, "%s-> chmod(%s,%o)\n",
  72. +                        CLIENT_SERVER_STR, fname,
  73. +                        (unsigned int) mode);
  74. +    if (noexec)
  75. +        return;
  76.  
  77. -    system (whole_cmd);
  78. -    free (whole_cmd);
  79. +    if (chmod (fname, mode) < 0)
  80. +        error (0, errno, "cannot change mode of file %s", fname);
  81.  }
  82.  
  83.  /*
  84.