Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 151664 Details for
Bug 220086
dev-util/debugedit-4.4.6-r1: patch to enable options for printing to newline delimited output to stdout AND read-only access
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
debugedit-4.4.6-readonly-and-print-stdout.patch (text/plain), 2.72 KB, created by
Christopher Layne
on 2008-05-03 01:55:58 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Christopher Layne
Created:
2008-05-03 01:55:58 UTC
Size:
2.72 KB
patch
obsolete
>--- debugedit-4.4.6/debugedit.c 2006-06-09 14:17:06.000000000 +0000 >+++ debugedit-4.4.6-r2/debugedit.c 2008-05-03 01:41:58.054845092 +0000 >@@ -43,6 +43,8 @@ > char *base_dir = NULL; > char *dest_dir = NULL; > char *list_file = NULL; >+int print_files; >+int read_only; > int list_file_fd = -1; > > typedef unsigned int uint_32; >@@ -567,13 +569,13 @@ > char *p; > size_t size; > ssize_t ret; >- if (base_dir) >- p = s + strlen (base_dir); >- else >- p = s; > > if (list_file_fd != -1) > { >+ if (base_dir) >+ p = s + strlen (base_dir); >+ else >+ p = s; > size = strlen (p) + 1; > while (size > 0) > { >@@ -584,6 +586,23 @@ > p += ret; > } > } >+ if (print_files) >+ { >+ if (base_dir) >+ p = s + strlen (base_dir); >+ else >+ p = s; >+ size = strlen (p) + 1; >+ while (size > 0) >+ { >+ ret = write (STDOUT_FILENO, p, size); >+ if (ret == -1) >+ break; >+ write (STDOUT_FILENO, "\n", 1); >+ size -= ret; >+ p += ret; >+ } >+ } > } > > free (s); >@@ -1193,6 +1212,10 @@ > "directory to rewrite base-dir into", NULL }, > { "list-file", 'l', POPT_ARG_STRING, &list_file, 0, > "file where to put list of source and header file names", NULL }, >+ { "print", 'p', POPT_ARG_NONE, &print_files, 0, >+ "print newline delimited list of file names to stdout", NULL }, >+ { "read-only", 'r', POPT_ARG_NONE, &read_only, 0, >+ "open read-only", NULL }, > POPT_AUTOHELP > { NULL, 0, 0, NULL, 0, NULL, NULL } > }; >@@ -1205,7 +1228,7 @@ > int i; > DSO *dso = NULL; > >- elf = elf_begin (fd, ELF_C_RDWR_MMAP, NULL); >+ elf = elf_begin (fd, read_only ? ELF_C_READ : ELF_C_RDWR_MMAP, NULL); > if (elf == NULL) > { > error (0, 0, "cannot open ELF file: %s", elf_errmsg (-1)); >@@ -1357,10 +1380,12 @@ > exit (1); > } > >- /* Make sure we can read and write */ >- chmod (file, stat_buf.st_mode | S_IRUSR | S_IWUSR); >+ if (!read_only) { >+ /* Make sure we can read and write */ >+ chmod (file, stat_buf.st_mode | S_IRUSR | S_IWUSR); >+ } > >- fd = open (file, O_RDWR); >+ fd = open (file, read_only ? O_RDONLY : O_RDWR); > if (fd < 0) > { > fprintf (stderr, "Failed to open input file '%s': %s\n", file, strerror(errno)); >@@ -1393,7 +1418,7 @@ > } > } > >- if (elf_update (dso->elf, ELF_C_WRITE) < 0) >+ if (!read_only && elf_update (dso->elf, ELF_C_WRITE) < 0) > { > fprintf (stderr, "Failed to write file: %s\n", elf_errmsg (elf_errno())); > exit (1); >@@ -1405,8 +1430,10 @@ > } > close (fd); > >- /* Restore old access rights */ >- chmod (file, stat_buf.st_mode); >+ if (!read_only) { >+ /* Restore old access rights */ >+ chmod (file, stat_buf.st_mode); >+ } > > poptFreeContext (optCon); >
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 220086
:
151664
|
151667
|
151669