Only clear the character backing store when the RI_CLEAR flag is set.
authorkettenis <kettenis@openbsd.org>
Sat, 22 Sep 2018 17:40:57 +0000 (17:40 +0000)
committerkettenis <kettenis@openbsd.org>
Sat, 22 Sep 2018 17:40:57 +0000 (17:40 +0000)
ok deraadt@

sys/dev/rasops/rasops.c

index ec2c7ba..4c1e8d2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rasops.c,v 1.56 2018/08/27 09:30:07 kettenis Exp $    */
+/*     $OpenBSD: rasops.c,v 1.57 2018/09/22 17:40:57 kettenis Exp $    */
 /*     $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $       */
 
 /*-
@@ -309,10 +309,12 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
                ri->ri_ops.eraserows = rasops_wronly_eraserows;
                ri->ri_do_cursor = rasops_wronly_do_cursor;
 
-               ri->ri_alloc_attr(ri, 0, 0, 0, &attr);
-               for (i = 0; i < ri->ri_rows * ri->ri_cols; i++) {
-                       ri->ri_bs[i].uc = ' ';
-                       ri->ri_bs[i].attr = attr;
+               if (ri->ri_flg & RI_CLEAR) {
+                       ri->ri_alloc_attr(ri, 0, 0, 0, &attr);
+                       for (i = 0; i < ri->ri_rows * ri->ri_cols; i++) {
+                               ri->ri_bs[i].uc = ' ';
+                               ri->ri_bs[i].attr = attr;
+                       }
                }
        }