drm-shim: fix EOF case
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Tue, 12 Nov 2019 11:46:20 +0000 (12:46 +0100)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 13 Nov 2019 12:39:14 +0000 (12:39 +0000)
Close input end of the pipe after data was written. Without this
fix I have seen a hang in sysfs_uevent_get(.., "OF_FULLNAME")
when key was not found.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/drm-shim/drm_shim.c

index 7c7d5f0f0092080b81b6246b71358a9c17814477..381a94fb9d1c7ccac26e4584cf0a3e1f6450942b 100644 (file)
@@ -219,6 +219,7 @@ PUBLIC FILE *fopen(const char *path, const char *mode)
          pipe(fds);
          write(fds[1], file_overrides[i].contents,
                strlen(file_overrides[i].contents));
+         close(fds[1]);
          return fdopen(fds[0], "r");
       }
    }