lib/replace: use snprintf() in test code to avoid warnings in the IBM-Checker
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Oct 2010 12:41:47 +0000 (14:41 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 23 Oct 2010 06:49:29 +0000 (08:49 +0200)
metze

lib/replace/test/os2_delete.c

index 8b52837018d9387323275fb6ef2fd6eff3b39202..9d760bfdc2f30c5754ca5d076d879612525ee48d 100644 (file)
@@ -46,7 +46,7 @@ static void create_files(void)
        for (i=0;i<NUM_FILES;i++) {
                char fname[40];
                int fd;
-               sprintf(fname, TESTDIR "/test%u.txt", i);
+               snprintf(fname, sizeof(fname), TESTDIR "/test%u.txt", i);
                fd = open(fname, O_CREAT|O_RDWR, 0600);
                if (fd < 0) {
                        FAILED("open");
@@ -79,7 +79,7 @@ static int os2_delete(DIR *d)
        /* delete the first few */
        for (j=0; j<MIN(i, DELETE_SIZE); j++) {
                char fname[40];
-               sprintf(fname, TESTDIR "/%s", names[j]);
+               snprintf(fname, sizeof(fname), TESTDIR "/%s", names[j]);
                unlink(fname) == 0 || FAILED("unlink");
        }