This test creates a directory, makes it non-writable, then calls XWriteBitmapFile to attempt to write to it, expecting it to fail with BitmapOpenFailed. This works fine when run as a normal user, but when run as root, writing the file succeeds anyway.
Check the euid and bail out with UNTESTED if it's root. Reported-by: Abhinav Shukla <[email protected]> Signed-off-by: Aaron Plattner <[email protected]> --- xts5/Xlib17/XWriteBitmapFile.m | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/xts5/Xlib17/XWriteBitmapFile.m b/xts5/Xlib17/XWriteBitmapFile.m index 63cbf76..f784fea 100644 --- a/xts5/Xlib17/XWriteBitmapFile.m +++ b/xts5/Xlib17/XWriteBitmapFile.m @@ -313,6 +313,13 @@ Verify that a BitmapOpenFailed error occurred. >>CODE int ret; +/* Writing won't fail even if the permissions say it should if we're root. */ + if(geteuid() == 0) { + report("File permissions cannot be tested as root."); + UNTESTED; + return; + } + /* Create a suitable bitmap. */ /* Create an unwritable directory. */ if(mkdir(XWBF_DIR, XWBF_MODE)) { -- 1.7.4.1 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
