summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2005-06-14 08:42:13 +0200
committerNeil Brown <neilb@suse.de>2005-06-14 08:42:13 +0200
commit8f23b0b3fa61cb112a974a711fe3c424482fe11d (patch)
tree83e83d147cc5d1da0a6a9b3189a42b0d937f2b0b /mdopen.c
parentAdd device files created with --auto to list of known device files. (diff)
downloadmdadm-8f23b0b3fa61cb112a974a711fe3c424482fe11d.tar.xz
mdadm-8f23b0b3fa61cb112a974a711fe3c424482fe11d.zip
Replace sprintf calls with snprintf
To quiet diet-libc Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Diffstat (limited to 'mdopen.c')
-rw-r--r--mdopen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mdopen.c b/mdopen.c
index 9309fbd2..81cf725b 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -42,7 +42,8 @@ void make_parts(char *dev, int cnt)
struct stat stb;
int major, minor;
int i;
- char *name = malloc(strlen(dev) + 20);
+ int nlen = strlen(dev) + 20;
+ char *name = malloc(nlen);
int dig = isdigit(dev[strlen(dev)-1]);
if (stat(dev, &stb)!= 0)
@@ -53,7 +54,7 @@ void make_parts(char *dev, int cnt)
minor = minor(stb.st_rdev);
for (i=1; i <= cnt ; i++) {
struct stat stb2;
- sprintf(name, "%s%s%d", dev, dig?"p":"", i);
+ snprintf(name, nlen, "%s%s%d", dev, dig?"p":"", i);
if (stat(name, &stb2)==0) {
if (!S_ISBLK(stb2.st_mode))
continue;