[xiph-cvs] cvs commit: vorbis-tools/vorbiscomment vcomment.c
Segher Boessenkool
segher at xiph.org
Wed Jan 23 09:14:05 PST 2002
segher 02/01/23 09:14:04
Modified: vorbiscomment vcomment.c
Log:
When using a temporary file, set the mode of the old file on the new file.
Closes #136.
Revision Changes Path
1.17 +10 -1 vorbis-tools/vorbiscomment/vcomment.c
Index: vcomment.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/vorbiscomment/vcomment.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- vcomment.c 2002/01/11 10:21:31 1.16
+++ vcomment.c 2002/01/23 17:14:04 1.17
@@ -12,6 +12,9 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include <locale.h>
#include "getopt.h"
#include "utf8.h"
@@ -478,6 +481,12 @@
if (p->out != NULL && p->out != stdout) fclose(p->out);
if (p->com != NULL && p->com != stdout && p->com != stdin) fclose(p->com);
- if(p->tempoutfile)
+ if(p->tempoutfile) {
+ /* this is not portable to non-posix systems */
+ struct stat st;
+
+ stat(p->infilename, &st);
rename(p->outfilename, p->infilename);
+ chmod(p->infilename, st.st_mode);
+ }
}
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list