zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: check deleted .zwc files
Date: Mon, 18 Jun 2001 09:31:17 +0200 (MET DST)	[thread overview]
Message-ID: <200106180731.JAA11431@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <1010613102249.ZM26263@candle.brasslantern.com>

Bart Schaefer wrote:

> On Jun 13, 10:59am, Sven Wischnowsky wrote:
> }
> } For 3. (zwc rewritten in place): I don't see a solution either, but was
> } thinking about implementing what you suggested (unlinking the file and
> } chmod()ing it). Should we just do that?
> 
> I'd say so, if there are no better ideas.

Nobody spoke up, so here is the patch that makes zcompile unlink() the
zwc file first and makes it use mode 0444 when creating these files.
Should it use 0400, so that system administrators have to chmod it by
hand?

That hunk in zwcstat() avoids a `unused variable' variable warning if
HAVE_FSTAT is not defined.


Bye
  Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.22
diff -u -r1.22 parse.c
--- Src/parse.c	2001/06/09 18:06:32	1.22
+++ Src/parse.c	2001/06/18 07:29:58
@@ -2544,7 +2544,8 @@
     if (!strsfx(FD_EXT, dump))
 	dump = dyncat(dump, FD_EXT);
 
-    if ((dfd = open(dump, O_WRONLY|O_CREAT, 0600)) < 0) {
+    unlink(dump);
+    if ((dfd = open(dump, O_WRONLY|O_CREAT, 0444)) < 0) {
 	zwarnnam(nam, "can't write zwc file: %s", dump, 0);
 	return 1;
     }
@@ -2675,7 +2676,8 @@
     if (!strsfx(FD_EXT, dump))
 	dump = dyncat(dump, FD_EXT);
 
-    if ((dfd = open(dump, O_WRONLY|O_CREAT, 0600)) < 0) {
+    unlink(dump);
+    if ((dfd = open(dump, O_WRONLY|O_CREAT, 0444)) < 0) {
 	zwarnnam(nam, "can't write zwc file: %s", dump, 0);
 	return 1;
     }
@@ -2779,10 +2781,10 @@
 static int
 zwcstat(char *filename, struct stat *buf, FuncDump dumps)
 {
-    FuncDump f;
-    
     if (stat(filename, buf)) {
 #ifdef HAVE_FSTAT
+        FuncDump f;
+    
 	for (f = dumps; f; f = f->next) {
 	    if (!strncmp(filename, f->filename, strlen(f->filename)) &&
 		!fstat(f->fd, buf))

-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


  reply	other threads:[~2001-06-18  7:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-08 18:17 Clint Adams
2001-06-08 18:50 ` Bart Schaefer
2001-06-08 19:04   ` Clint Adams
2001-06-08 19:46     ` Bart Schaefer
2001-06-08 19:53       ` Clint Adams
2001-06-09  5:37         ` Andrej Borsenkow
2001-06-10 11:11           ` Clint Adams
2001-06-09 20:58         ` Bart Schaefer
2001-06-10 11:34           ` Clint Adams
2001-06-13  5:03             ` Bart Schaefer
2001-06-13  8:59               ` Sven Wischnowsky
2001-06-13 10:22                 ` Bart Schaefer
2001-06-18  7:31                   ` Sven Wischnowsky [this message]
2001-06-09 10:05 ` Cygwin failure " Andrej Borsenkow
2001-06-09 17:42   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200106180731.JAA11431@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).