diff options
author | Neil Brown <neilb@suse.de> | 2005-06-14 08:42:13 +0200 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2005-06-14 08:42:13 +0200 |
commit | 8f23b0b3fa61cb112a974a711fe3c424482fe11d (patch) | |
tree | 83e83d147cc5d1da0a6a9b3189a42b0d937f2b0b /mdopen.c | |
parent | Add device files created with --auto to list of known device files. (diff) | |
download | mdadm-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |