50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
|
|
My patch that helps when expanding the OpenBSD-cvs-x11 deltas.
|
|
Sometimes the files extracted are read-only. Rather than abort out in
|
|
a big mess, this patch checks for unwritable files, and chmods them
|
|
if you specify the -F (force) flag. - d@
|
|
|
|
--- ctm/ctm/ctm_pass2.c.orig Fri Feb 18 16:12:35 2000
|
|
+++ ctm/ctm/ctm_pass2.c Fri Feb 18 16:40:02 2000
|
|
@@ -114,6 +114,11 @@
|
|
ret |= Exit_NotOK;
|
|
break;
|
|
}
|
|
+ if (-1 == access(name, W_OK)) {
|
|
+ fprintf(stderr, " %s: %s not writable.\n",
|
|
+ sp->Key, name);
|
|
+ ret |= Exit_Forcible;
|
|
+ }
|
|
if (SetTime && getuid() && (getuid() != st.st_uid)) {
|
|
fprintf(stderr,
|
|
" %s: %s not mine, cannot set time.\n",
|
|
--- ctm/ctm/ctm_pass3.c.orig Fri Feb 18 16:12:30 2000
|
|
+++ ctm/ctm/ctm_pass3.c Fri Feb 18 16:42:36 2000
|
|
@@ -176,6 +176,26 @@
|
|
|
|
if (Verbose > 0)
|
|
fprintf(stderr,"> %s %s\n",sp->Key,name);
|
|
+ if ((strcmp(sp->Key, "FS") == 0 ||
|
|
+ strcmp(sp->Key, "FN") == 0 ||
|
|
+ strcmp(sp->Key, "FE") == 0) && -1 == access(name, W_OK)) {
|
|
+ if (Verbose > 1)
|
|
+ fprintf(stderr, " %s: chmod u+w %s\n",
|
|
+ sp->Key, name);
|
|
+ if (!Force) {
|
|
+ warn("%s", name);
|
|
+ WRONG
|
|
+ }
|
|
+ if (-1 == stat(name, &st)) {
|
|
+ warn("stat: %s", name);
|
|
+ WRONG
|
|
+ }
|
|
+ if (-1 == chmod(name, st.st_mode | S_IWUSR)) {
|
|
+ warn("chmod: %s", name);
|
|
+ WRONG
|
|
+ }
|
|
+ }
|
|
+
|
|
if(!strcmp(sp->Key,"FM") || !strcmp(sp->Key, "FS")) {
|
|
i = open(name,O_WRONLY|O_CREAT|O_TRUNC,0666);
|
|
if(i < 0) {
|