Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Computation  at follow_stream.c:451

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

follow_print_stream

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/follow_stream.c)expand/collapse
Show more  
 389  follow_print_stream(GtkWidget * w _U_, gpointer data)
 390  {
 391          print_stream_t  *stream;
 392          gboolean         to_file;
 393          char            *print_dest;
 394          follow_info_t   *follow_info = data;
 395  #ifdef _WIN32 
 396          gboolean         win_printer = FALSE;
 397          int              tmp_fd;
 398          char             tmp_namebuf[128+1];  /* see create_tmpfile which says [128+1]; why ? */
 399  #endif
 400   
 401          switch (prefs.pr_dest) {
 402          case PR_DEST_CMD:
 403  #ifdef _WIN32 
 404                  win_printer = TRUE;
 405                  /* (The code for creating a temp filename is adapted from print_dlg.c).   */
 406                  /* We currently don't have a function in util.h to create just a tempfile */
 407                  /* name, so simply create a tempfile using the "official" function,       */
 408                  /* then delete this file again. After this, the name MUST be available.   */
 409                  /* */
 410                  /* Don't use tmpnam() or such, as this will fail under some ACL           */
 411                  /* circumstances: http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=358  */
 412                  /* Also: tmpnam is "insecure" and should not be used.                     */
 413                  tmp_fd = create_tempfile(tmp_namebuf, sizeof(tmp_namebuf), "wshprint");
 414                  if(tmp_fd == -1) {
 415                          simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 416                                        "Couldn't create a temporary file for printing.");
 417                          return;
 418                  }
 419                  ws_close(tmp_fd);
 420                  ws_unlink(tmp_namebuf);
 421                  print_dest = tmp_namebuf;
 422                  to_file = TRUE;
 423  #else
 424                  print_dest = prefs.pr_cmd;
 425                  to_file = FALSE;
 426  #endif
 427                  break;
 428          case PR_DEST_FILE:
 429                  print_dest = prefs.pr_file;
 430                  to_file = TRUE;
 431                  break;
 432          default:                        /* "Can't happen" */
 433                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 434                                "Couldn't figure out where to send the print "
 435                                "job. Check your preferences.");
 436                  return;
 437          }
 438   
 439          switch (prefs.pr_format) {
 440   
 441          case PR_FMT_TEXT:
 442                  stream = print_stream_text_new(to_file, print_dest);
 443                  break;
 444   
 445          case PR_FMT_PS:
 446                  stream = print_stream_ps_new(to_file, print_dest);
 447                  break;
 448   
 449          default:
 450                  g_assert_not_reached();
 451                  stream = NULL;
 452          }
 453          if (stream == NULL) {
 454                  if (to_file) {
 455                          open_failure_alert_box(print_dest, errno, TRUE);
 456                  } else {
 457                          simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 458                                        "Couldn't run print command %s.",
 459                                        prefs.pr_cmd);
 460                  }
 461                  return;
 462          }
 463   
 464          if (!print_preamble(stream, cfile.filename))
 465                  goto print_error;
 466   
 467          switch (follow_read_stream(follow_info, follow_print_text, stream)) {
 468          case FRS_OK:
 469                  break;
 470          case FRS_OPEN_ERROR:
 471          case FRS_READ_ERROR:
 472                  /* XXX - cancel printing? */
 473                  destroy_print_stream(stream);
 474                  return;
 475          case FRS_PRINT_ERROR:
 476                  goto print_error;
 477          }
 478   
 479          if (!print_finale(stream))
 480                  goto print_error;
 481   
 482          if (!destroy_print_stream(stream)) {
 483                  if (to_file) {
 484                          write_failure_alert_box(print_dest, errno);
 485                  } else {
 486                          simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 487                                        "Error closing print destination.");
 488                  }
 489          }
 490  #ifdef _WIN32 
 491          if (win_printer) {
 492                  print_mswin(print_dest);
 493   
 494                  /* trash temp file */
 495                  ws_remove(print_dest);
 496          }
 497  #endif
 498          return;
 499   
 500   print_error:
 501          if (to_file) {
 502                  write_failure_alert_box(print_dest, errno);
 503          } else {
 504                  simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
 505                                "Error writing to print command: %s",
 506                                strerror(errno));
 507          }
 508          /* XXX - cancel printing? */
 509          destroy_print_stream(stream);
 510   
 511  #ifdef _WIN32 
 512          if (win_printer) {
 513                  /* trash temp file */
 514                  ws_remove(print_dest);
 515          }
 516  #endif
 517  }
Show more  




Change Warning 4088.30724 : Unreachable Computation

Priority:
State:
Finding:
Owner:
Note: