mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle McMartin <kmcmartin@redhat.com>
To: jcm@jonmasters.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix depmod to handle passing 3.0 version numbers
Date: Mon, 30 May 2011 09:32:32 -0400	[thread overview]
Message-ID: <20110530133232.GB13573@ihatethathostname.lab.bos.redhat.com> (raw)

depmod with a 3.x version number passed in breaks since it's
testing for 3.x.y still, fix that.

(I can confirm it works and fixes modules.dep generation during fedora
 package builds.)

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>
---
diff --git a/depmod.c b/depmod.c
index abfb11e..853b52b 100644
--- a/depmod.c
+++ b/depmod.c
@@ -245,9 +245,16 @@ static const struct option options[] = { { "all", 0, NULL, 'a' },
 /* Version number or module name?  Don't assume extension. */
 static int is_version_number(const char *version)
 {
-	unsigned int dummy;
+	int ret;
+	unsigned int major, dummy;
 
-	return (sscanf(version, "%u.%u.%u", &dummy, &dummy, &dummy) == 3);
+	ret = sscanf(version, "%u.%u", &major, &dummy);
+	if ((major == 3) && (ret == 2))
+		return 1;
+
+	ret = sscanf(version, "%u.%u.%u", &dummy, &dummy, &dummy);
+
+	return (ret == 3);
 }
 
 static int old_module_version(const char *version)

                 reply	other threads:[~2011-05-30 13:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110530133232.GB13573@ihatethathostname.lab.bos.redhat.com \
    --to=kmcmartin@redhat.com \
    --cc=jcm@jonmasters.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®