- if (do_open(gv,PL_oldname,oldlen,PL_inplace!=0,O_RDONLY,0,NULL)) {
- if (PL_inplace) {
+ if (LIKELY(!PL_inplace)) {
+ if (nomagicopen
+ ? do_open6(gv, "<", 1, NULL, &GvSV(gv), 1)
+ : do_open6(gv, PL_oldname, oldlen, NULL, NULL, 0)
+ ) {
+ return IoIFP(GvIOp(gv));
+ }
+ }
+ else {
+ {
+ IO * const io = GvIOp(PL_argvoutgv);
+ if (io && IoIFP(io) && old_out_name && !io_close(io, PL_argvoutgv, FALSE, FALSE)) {
+ Perl_croak(aTHX_ "Failed to close in-place edit file %"SVf": %s\n",
+ old_out_name, Strerror(errno));
+ }
+ }
+ /* This very long block ends with return IoIFP(GvIOp(gv));
+ Both this block and the block above fall through on open
+ failure to the warning code, and then the while loop above tries
+ the next entry. */
+ if (do_open_raw(gv, PL_oldname, oldlen, O_RDONLY, 0)) {
+#ifndef FLEXFILENAMES
+ int filedev;
+ int fileino;
+#endif
+ Uid_t fileuid;
+ Gid_t filegid;
+