From bd14cedaeb00ac3fc52ff40e4610f801aca11f5f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 28 Oct 1995 01:09:58 +0000 Subject: [PATCH] Guarantee that target file of copy operation is writable. --- v7/src/microcode/pros2fs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/v7/src/microcode/pros2fs.c b/v7/src/microcode/pros2fs.c index 5bad64c95..9fe68af8e 100644 --- a/v7/src/microcode/pros2fs.c +++ b/v7/src/microcode/pros2fs.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: pros2fs.c,v 1.9 1995/10/28 00:57:02 cph Exp $ +$Id: pros2fs.c,v 1.10 1995/10/28 01:09:58 cph Exp $ Copyright (c) 1994-95 Massachusetts Institute of Technology @@ -424,6 +424,16 @@ DEFINE_PRIMITIVE ("OS2-DAYLIGHT-SAVINGS-TIME?", Prim_OS2_dst_p, 0, 0, 0) DEFINE_PRIMITIVE ("OS2-COPY-FILE", Prim_OS2_copy_file, 2, 2, 0) { PRIMITIVE_HEADER (2); - STD_API_CALL (dos_copy, (STRING_ARG (1)), (STRING_ARG (2)), DCPY_EXISTING) + { + const char * from = (STRING_ARG (1)); + const char * to = (STRING_ARG (2)); + FILESTATUS3 * info = (OS2_read_file_status (to)); + if ((info != 0) && (((info -> attrFile) & FILE_READONLY) != 0)) + { + (info -> attrFile) &=~ FILE_READONLY; + OS2_write_file_status (to, info); + } + STD_API_CALL (dos_copy, from, to, DCPY_EXISTING); + } PRIMITIVE_RETURN (UNSPECIFIC); } -- 2.25.1