Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 88797 Details for
Bug 135745
gcc tries to write gcda files in wrong dir (read-only by sandbox).
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
return normal failure when open/fopen fail because file to read does not exist
sandbox-opennormalfail.patch (text/plain), 2.43 KB, created by
Kevin F. Quinn (RETIRED)
on 2006-06-09 16:24:08 UTC
(
hide
)
Description:
return normal failure when open/fopen fail because file to read does not exist
Filename:
MIME Type:
Creator:
Kevin F. Quinn (RETIRED)
Created:
2006-06-09 16:24:08 UTC
Size:
2.43 KB
patch
obsolete
>--- src/libsandbox.c.orig 2006-06-10 01:25:35.000000000 +0200 >+++ src/libsandbox.c 2006-06-10 01:28:11.000000000 +0200 >@@ -82,6 +82,9 @@ > #define FUNCTION_SANDBOX_SAFE_ACCESS(_func, _path, _flags) \ > ((0 == is_sandbox_on()) || (1 == before_syscall_access(_func, _path, _flags))) > >+#define FUNCTION_SANDBOX_FAIL_OPEN_INT(_func, _path, _flags) \ >+ ((0 == is_sandbox_on()) || (1 == before_syscall_open_int(_func, _path, _flags))) >+ > #define FUNCTION_SANDBOX_SAFE_OPEN_INT(_func, _path, _flags) \ > ((0 == is_sandbox_on()) || (1 == before_syscall_open_int(_func, _path, _flags))) > >@@ -390,6 +393,16 @@ > FILE *_name(const char *pathname, const char *mode) \ > { \ > FILE *result = NULL; \ >+ int my_errno = errno; \ >+ struct stat st; \ >+\ >+ if (mode!=NULL && mode[0]=='r') { \ >+ /* If we're trying to read, fail normally if file does not stat */\ >+ if (-1 == stat(pathname, &st)) { \ >+ return NULL; \ >+ } \ >+ } \ >+ errno = my_errno; \ > \ > if FUNCTION_SANDBOX_SAFE_OPEN_CHAR("fopen", pathname, mode) { \ > check_dlsym(_name); \ >@@ -563,12 +576,20 @@ > va_list ap; \ > int mode = 0; \ > int result = -1; \ >+ int my_errno = errno; \ >+ struct stat st; \ > \ > if (flags & O_CREAT) { \ > va_start(ap, flags); \ > mode = va_arg(ap, int); \ > va_end(ap); \ >+ } else { \ >+ /* If we're not trying to create, fail normally if file does not stat */\ >+ if (-1 == stat(pathname, &st)) { \ >+ return -1; \ >+ } \ > } \ >+ errno = my_errno; \ > \ > if FUNCTION_SANDBOX_SAFE_OPEN_INT("open", pathname, flags) { \ > check_dlsym(_name); \ >@@ -728,6 +749,16 @@ > FILE *_name(const char *pathname, const char *mode) \ > { \ > FILE *result = NULL; \ >+ int my_errno = errno; \ >+ struct stat64 st; \ >+\ >+ if (mode!=NULL && mode[0]=='r') { \ >+ /* If we're trying to read, fail normally if file does not stat */\ >+ if (-1 == stat64(pathname, &st)) { \ >+ return NULL; \ >+ } \ >+ } \ >+ errno = my_errno; \ > \ > if FUNCTION_SANDBOX_SAFE_OPEN_CHAR("fopen64", pathname, mode) { \ > check_dlsym(_name); \ >@@ -748,12 +779,20 @@ > va_list ap; \ > int mode = 0; \ > int result = -1; \ >+ int my_errno = errno; \ >+ struct stat64 st; \ > \ > if (flags & O_CREAT) { \ > va_start(ap, flags); \ > mode = va_arg(ap, int); \ > va_end(ap); \ >+ } else { \ >+ /* If we're not trying to create, fail normally if file does not stat */\ >+ if (-1 == stat64(pathname, &st)) { \ >+ return -1; \ >+ } \ > } \ >+ errno = my_errno; \ > \ > if FUNCTION_SANDBOX_SAFE_OPEN_INT("open64", pathname, flags) { \ > check_dlsym(_name); \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 135745
: 88797 |
91504
|
133144