FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

 
 
LinkBack Thread Tools
 
Old 05-25-2010, 05:51 PM
David Cantrell
 
Default Correct problem with initrd.addrsize generation (#546422)

The last write() line was writing out the addr value again instead of
size. Also include libgen.h for basename() call and lose the char *
we never use from the strtoul() call.
---
utils/addrsize.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/utils/addrsize.c b/utils/addrsize.c
index 5933a00..f1b1a7d 100644
--- a/utils/addrsize.c
+++ b/utils/addrsize.c
@@ -32,6 +32,7 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
+#include <libgen.h>

int main(int argc,char **argv) {
char *cmd = basename(argv[0]);
@@ -39,7 +40,6 @@ int main(int argc,char **argv) {
struct stat initrd_stat;
unsigned int addr = 0, size = 0, zero = 0;
int fd, rc;
- char *tmp = NULL;
mode_t mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH;

if (argc != 4) {
@@ -59,7 +59,7 @@ int main(int argc,char **argv) {
return 2;
}

- addr = htonl(strtoul(address, &tmp, 0));
+ addr = htonl(strtoul(address, NULL, 0));
size = htonl(initrd_stat.st_size);
fd = open(output, O_CREAT | O_RDWR, mode);

@@ -78,7 +78,7 @@ int main(int argc,char **argv) {
return 5;
}

- if (write(fd, &addr, sizeof(int)) == -1) {
+ if (write(fd, &size, sizeof(int)) == -1) {
perror("writing initrd.addr (zero) ");
return 6;
}
--
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 02:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org