comparison example/dummy.c @ 13:5971a90f2459

Fix some gcc warnings
author AngelCarpintero
date Tue, 20 Jan 2009 12:23:52 +0000
parents 2fce9e157b8d
children
comparison
equal deleted inserted replaced
12:bc21025dcf6d 13:5971a90f2459
319 istatus = strtok(NULL, "\t"); 319 istatus = strtok(NULL, "\t");
320 output = strtok(NULL, "\t"); 320 output = strtok(NULL, "\t");
321 ostatus = strtok(NULL, "\t"); 321 ostatus = strtok(NULL, "\t");
322 322
323 if (istatus[0] == '-') { 323 if (istatus[0] == '-') {
324 sprintf(pipepath, "/dev/%s", input); 324 snprintf(pipepath, 255, "/dev/%s", input);
325 pipe_fd = open(pipepath, O_RDWR); 325 pipe_fd = open(pipepath, O_RDWR);
326 326
327 if (pipe_fd >= 0) { 327 if (pipe_fd >= 0) {
328 printf("Input: /dev/%s\n", input); 328 printf("Input: /dev/%s\n", input);
329 printf("Output: /dev/%s\n", output); 329 printf("Output: /dev/%s\n", output);
347 return -1; 347 return -1;
348 } 348 }
349 349
350 while ((dirp = readdir(dir)) != NULL) { 350 while ((dirp = readdir(dir)) != NULL) {
351 if (!strncmp(dirp->d_name, "video", 5)) { 351 if (!strncmp(dirp->d_name, "video", 5)) {
352 strcpy(buffer, prefix); 352 strncpy(buffer, prefix, 255 - strlen(prefix));
353 strcat(buffer, dirp->d_name); 353 strncat(buffer, dirp->d_name, 255 - strlen(buffer));
354 strcat(buffer, "/name"); 354 strncat(buffer, "/name", 255 - strlen(buffer));
355 355
356 if ((fd = open(buffer, O_RDONLY)) >= 0) { 356 if ((fd = open(buffer, O_RDONLY)) >= 0) {
357 if ((read(fd, buffer, sizeof(buffer)-1)) < 0) { 357 if ((read(fd, buffer, sizeof(buffer)-1)) < 0) {
358 close(fd); 358 close(fd);
359 continue; 359 continue;