Przeglądaj źródła

* Dont chmod() on CYGWIN

svn: 963
Bryan Drewery 22 lat temu
rodzic
commit
02670905a3

+ 1 - 0
doc/UPDATES

@@ -22,6 +22,7 @@ This is a summary of ChangeLog basically.
    issuing the cmd has access for the channel.
 18.cmd_getkey now recognizes +private.
 19.Limits were not being set.
+20.No longer chmodding on CYGWIN
 
 1.1.5
 

+ 1 - 1
src/misc.c

@@ -746,7 +746,7 @@ int updatebin(int idx, char *par, int autoi)
     free(path);
     return 1;
   }
-  if (chmod(path, S_IRUSR | S_IWUSR | S_IXUSR)) {
+  if (fixmod(path)) {
     logidx(idx, "Can't set mode 0600 on %s", path);
     free(path);
     return 1;

+ 4 - 0
src/misc_file.c

@@ -136,6 +136,7 @@ int is_dir(const char *s)
 
 int fixmod(const char *s)
 {
+#ifndef CYGWIN_HACKS
   int i;
 
   if (!can_stat(s))
@@ -144,4 +145,7 @@ int fixmod(const char *s)
   if (i < 0)
     return 0;
   return 1;
+#else
+  return 0;
+#endif /* !CYGWIN_HACKS */
 }

+ 5 - 5
src/mod/notes.mod/notes.c

@@ -109,7 +109,7 @@ static void notes_change(char *oldnick, char *newnick)
     fclose(f);
     return;
   }
-  chmod(s, userfile_perm);	/* Use userfile permissions. */
+  fixmod(s);
   while (!feof(f)) {
     fgets(s, 512, f);
     if (!feof(f)) {
@@ -156,7 +156,7 @@ static void expire_notes()
     fclose(f);
     return;
   }
-  chmod(s, userfile_perm);	/* Use userfile permissions. */
+  fixmod(s);
   while (!feof(f)) {
     fgets(s, 512, f);
     if (!feof(f)) {
@@ -285,7 +285,7 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
 	char *p = NULL, *from = argv1;
 	size_t len = 0;
 
-	chmod(notefile, userfile_perm);	/* Use userfile permissions. */
+	fixmod(notefile);
 	while ((argv3[0] == '<') || (argv3[0] == '>')) {
 	  p = newsplit(&(argv3));
 	  if (*p == '<')
@@ -504,7 +504,7 @@ void notes_del(char *hand, char *nick, char *sdl, int idx)
     fclose(f);
     return;
   }
-  chmod(s, userfile_perm);	/* Use userfile permissions. */
+  fixmod(s);
   notes_parse(dl, sdl);
   while (!feof(f)) {
     fgets(s, 512, f);
@@ -647,7 +647,7 @@ static int msg_notes(char *nick, char *host, struct userrec *u, char *par)
       putlog(LOG_MISC, "*", "* %s", NOTES_NOTEFILE_UNREACHABLE);
       return 1;
     }
-    chmod(notefile, userfile_perm);	/* Use userfile permissions. */
+    fixmod(notefile);
     fprintf(f, "%s %s %li %s\n", to, u->handle, now, par);
     fclose(f);
     dprintf(DP_HELP, "NOTICE %s :%s\n", nick, NOTES_DELIVERED);

+ 2 - 1
src/mod/share.mod/share.c

@@ -8,6 +8,7 @@
 #include "src/rfc1459.h"
 #include "src/botmsg.h"
 #include "src/misc.h"
+#include "src/misc_file.h"
 #include "src/cmds.h"
 #include "src/chanprog.h"
 #include "src/users.h"
@@ -1237,7 +1238,7 @@ write_tmp_userfile(char *fn, const struct userrec *bu, int idx)
     time_t tt;
     char s1[81] = "";
 
-    chmod(fn, 0600);            /* make it -rw------- */
+    fixmod(fn);
     tt = now;
     strcpy(s1, ctime(&tt));
     lfprintf(f, "#4v: %s -- %s -- written %s", ver, conf.bot->nick, s1);

+ 1 - 1
src/mod/update.mod/update.c

@@ -263,7 +263,7 @@ void finish_update(int idx)
   sprintf(buf, "%s%s", dirname(binname),  strrchr(dcc[idx].u.xfer->filename, '/'));
 
   movefile(dcc[idx].u.xfer->filename, buf); 
-  chmod(buf, S_IRUSR | S_IWUSR | S_IXUSR);
+  fixmod(buf);
 
   sprintf(buf, "%s", strrchr(buf, '/'));
   buf2 = buf;

+ 1 - 1
src/userrec.c

@@ -409,7 +409,7 @@ int write_userfile(int idx)
   sprintf(new_userfile, "%s~new", userfile);
 
   f = fopen(new_userfile, "w");
-  chmod(new_userfile, 0600);
+  fixmod(new_userfile);
   if (f == NULL) {
     putlog(LOG_MISC, "*", USERF_ERRWRITE);
     free(new_userfile);