home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cvs1107.zip
/
patches.os2
< prev
next >
Wrap
Text File
|
2000-01-13
|
3KB
|
84 lines
--- emx\config.h.orig Wed Dec 31 03:03:16 1997
+++ emx\config.h Tue Jan 11 11:03:50 2000
@@ -312,5 +312,3 @@ extern int os2_fnmatch(const char *patte
/* See above; we can't use rsh without -b. */
#define RSH_NOT_TRANSPARENT 1
-/* See discussion at xchmod in filesubr.c. */
-#define CHMOD_BROKEN 1
--- emx\filesubr.c.orig Thu Apr 9 10:19:44 1998
+++ emx\filesubr.c Tue Jan 11 11:20:36 2000
@@ -307,20 +307,15 @@ mkdir_if_needed (name)
/*
* Change the mode of a file, either adding write permissions, or removing
* all write permissions. Either change honors the current umask setting.
- * The EMX doc (0.9c, emxlib.doc) says that chmod sets/clears the readonly
- * bit. But it always seemed to be a noop when I tried it. Therefore,
- * I've copied over the "attrib" code from os2/filesubr.c.
+ * The EMX doc (0.9d, emxlib.doc) says that chmod sets/clears the readonly
+ * bit. It does works and won't leave ugly stuff on screen if using 4OS2
*/
void
xchmod (fname, writable)
char *fname;
int writable;
{
- char *attrib_cmd;
- char *attrib_option;
- char *whole_cmd;
- char *p;
- char *q;
+ int mode;
if (!isfile (fname))
{
@@ -329,38 +324,20 @@ xchmod (fname, writable)
return;
}
- attrib_cmd = "attrib "; /* No, really? */
-
if (writable)
- attrib_option = "-r "; /* make writeable */
+ mode = S_IWRITE|S_IREAD; /* make writeable*/
else
- attrib_option = "+r "; /* make read-only */
+ mode = S_IREAD; /* make read-only*/
- whole_cmd = xmalloc (strlen (attrib_cmd)
- + strlen (attrib_option)
- + strlen (fname)
- + 1);
-
- strcpy (whole_cmd, attrib_cmd);
- strcat (whole_cmd, attrib_option);
-
- /* Copy fname to the end of whole_cmd, translating / to \.
- Attrib doesn't take / but many parts of CVS rely
- on being able to use it. */
- p = whole_cmd + strlen (whole_cmd);
- q = fname;
- while (*q)
- {
- if (*q == '/')
- *p++ = '\\';
- else
- *p++ = *q;
- ++q;
- }
- *p = '\0';
+ if (trace)
+ (void) fprintf (stderr, "%s-> chmod(%s,%o)\n",
+ CLIENT_SERVER_STR, fname,
+ (unsigned int) mode);
+ if (noexec)
+ return;
- system (whole_cmd);
- free (whole_cmd);
+ if (chmod (fname, mode) < 0)
+ error (0, errno, "cannot change mode of file %s", fname);
}
/*