Fix file-descriptor leak when pipes fail via taint checks:
[p5sagit/p5-mst-13.2.git] / sv.h
diff --git a/sv.h b/sv.h
index ffcc4aa..5993a8d 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -611,23 +611,28 @@ struct xpvio {
 #  endif
 #endif /* __GNUC__ */
 
-/* the following macro updates any magic values this sv is associated with */
+/* the following macros update any magic values this sv is associated with */
 
-#define SvSETMAGIC(x) if (SvSMAGICAL(x)) mg_set(x)
+#define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
+#define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END
 
 #define SvSetSV_and(dst,src,finally) \
+       STMT_START {                                    \
            if ((dst) != (src)) {                       \
                sv_setsv(dst, src);                     \
                finally;                                \
-           }
+           }                                           \
+       } STMT_END
 #define SvSetSV_nosteal_and(dst,src,finally) \
+       STMT_START {                                    \
            if ((dst) != (src)) {                       \
                U32 tMpF = SvFLAGS(src) & SVs_TEMP;     \
                SvTEMP_off(src);                        \
                sv_setsv(dst, src);                     \
                SvFLAGS(src) |= tMpF;                   \
                finally;                                \
-           }
+           }                                           \
+       } STMT_END
 
 #define SvSetSV(dst,src) \
                SvSetSV_and(dst,src,/*nothing*/;)