(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/follow_stream.c) |
| |
| 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]; |
| 399 | | | #endif |
| 400 | | | |
| 401 | | | switch (prefs.pr_dest) { |
| 402 | | | case PR_DEST_CMD: |
| 403 | | | #ifdef _WIN32 |
| 404 | | | win_printer = TRUE; |
| 405 | | | |
| 406 | | | |
| 407 | | | |
| 408 | | | |
| 409 | | | |
| 410 | | | |
| 411 | | | |
| 412 | | | |
| 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: |
| 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();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 451 | | | stream = NULL; |
Unreachable Computation
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 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 | | | |
| 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 | | | |
| 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 | | | |
| 509 | | | destroy_print_stream(stream); |
| 510 | | | |
| 511 | | | #ifdef _WIN32 |
| 512 | | | if (win_printer) { |
| 513 | | | |
| 514 | | | ws_remove(print_dest); |
| 515 | | | } |
| 516 | | | #endif |
| 517 | | | } |
| |