grub2/0002-linux-getroot-fix-descriptor-leak.patch
Andrei Borzenkov 1a0ddd28c8 Accepting request 336940 from home:michael-chang:branches:Base:System
- Upstream patches for fixing file descriptor leakage (bsc#943784) 
  * added 0001-unix-password-Fix-file-descriptor-leak.patch
  * added 0002-linux-getroot-fix-descriptor-leak.patch
  * added 0003-util-grub-mount-fix-descriptor-leak.patch
  * added 0004-linux-ofpath-fix-descriptor-leak.patch
  * added 0005-grub-fstest-fix-descriptor-leak.patch

OBS-URL: https://build.opensuse.org/request/show/336940
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=181
2015-10-12 08:10:07 +00:00

25 lines
790 B
Diff

From 6704abade6674a91d8c652a7e4596ca3421411b6 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Mon, 26 Jan 2015 21:38:40 +0300
Subject: [PATCH] linux/getroot: fix descriptor leak.
Found by: Coverity scan.
---
grub-core/osdep/linux/getroot.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
Index: grub-2.02~beta2/grub-core/osdep/linux/getroot.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/osdep/linux/getroot.c 2015-09-22 17:10:33.177530851 +0800
+++ grub-2.02~beta2/grub-core/osdep/linux/getroot.c 2015-09-22 17:13:27.269530851 +0800
@@ -368,7 +368,8 @@
ret[1+namelen] = '\0';
}
if (!ret)
- return xstrdup ("/");
+ ret = xstrdup ("/");
+ close (fd);
return ret;
}