Linux Container Development
 help / color / mirror / Atom feed
From: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Sukadev Bhattiprolu
	<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: mktree.c does not compile with v14 ?
Date: Mon, 30 Mar 2009 18:47:06 -0700	[thread overview]
Message-ID: <87ab72h3ad.fsf@caffeine.danplanet.com> (raw)
In-Reply-To: <20090331005703.GA19223-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> (Sukadev Bhattiprolu's message of "Mon, 30 Mar 2009 17:57:03 -0700")

Hi Suka,

SB> I am trying to compile mktree.c with [v14-rc1] but get this:

I had the same problem and had to fix up mktree.c a bit.  Oren said he
had a fix for this, but I haven't seen it yet.  So, I've included mine
at the bottom in case it helps.

-- 
Dan Smith
IBM Linux Technology Center
email: danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org

Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 mktree.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/mktree.c b/mktree.c
index c97c2de..65a0fdc 100644
--- a/mktree.c
+++ b/mktree.c
@@ -560,18 +560,24 @@ static int cr_read_head(struct cr_ctx *ctx)
 	if (ret < 0)
 		return ret;
 
-	len = hh->uts_len;
+	len = hh->uts_release_len + hh->uts_version_len + hh->uts_machine_len;
 	if (len < 0 || len > BUFSIZE / 4)
 		return -EINVAL;
 	ptr = (char *) (hh + 1);
 
-	ret = cr_read_obj_buffer(ctx, ptr, len);
+	len = 0;
+
+	ret = cr_read_obj_buffer(ctx, ptr, hh->uts_release_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_read_obj_buffer(ctx, ptr + len, len);
+	len += hh->uts_release_len;
+
+	ret = cr_read_obj_buffer(ctx, ptr + len, hh->uts_version_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_read_obj_buffer(ctx, ptr + 2*len, len);
+	len += hh->uts_version_len;
+
+	ret = cr_read_obj_buffer(ctx, ptr + len, hh->uts_machine_len);
 	if (ret < 0)
 		return ret;
 
@@ -627,7 +633,7 @@ static int cr_write_head(struct cr_ctx *ctx)
 	struct cr_hdr h;
 	struct cr_hdr_head *hh;
 	char *ptr;
-	int len, ret;
+	int len = 0, ret;
 
 	h.type = CR_HDR_HEAD;
 	h.len = sizeof(*hh);
@@ -636,16 +642,19 @@ static int cr_write_head(struct cr_ctx *ctx)
 	if (ret < 0)
 		return ret;
 
-	len = hh->uts_len;
 	ptr = (char *) (hh + 1);
 
-	ret = cr_write_obj_buffer(ctx, ptr, len);
+	ret = cr_write_obj_buffer(ctx, ptr, hh->uts_release_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_write_obj_buffer(ctx, ptr + len, len);
+	len += hh->uts_release_len;
+
+	ret = cr_write_obj_buffer(ctx, ptr + len, hh->uts_version_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_write_obj_buffer(ctx, ptr + 2*len, len);
+	len += hh->uts_version_len;
+
+	ret = cr_write_obj_buffer(ctx, ptr + len, hh->uts_machine_len);
 
 	return ret;
 }
-- 
1.5.6.3

  parent reply	other threads:[~2009-03-31  1:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31  0:57 mktree.c does not compile with v14 ? Sukadev Bhattiprolu
     [not found] ` <20090331005703.GA19223-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-31  1:47   ` Dan Smith [this message]
2009-03-31 15:08   ` Oren Laadan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ab72h3ad.fsf@caffeine.danplanet.com \
    --to=danms-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox