/* * sfdisk --verify [<device ..] */ static int command_verify(struct sfdisk *sf, int argc, char **argv) { int nfails = 0, ct = 0; if (argc) { int i; for (i = 0; i < argc; i++) { if (i) fdisk_info(sf->cxt, " "); if (verify_device(sf, argv[i]) < 0) nfails++; } } else { FILE *f = NULL; char *dev; while ((dev = next_proc_partition(&f))) { if (ct) fdisk_info(sf->cxt, " "); if (verify_device(sf, dev) < 0) nfails++; free(dev); ct++; } } return nfails; }
static gboolean update_source (NcbSelection *selection) { char *name = NULL; guint64 size; gboolean res; gboolean is_copy; GError *error; is_copy = FALSE; error = NULL; switch (selection->priv->source_type) { case NCB_SELECTION_SOURCE_BURN_FOLDER: res = verify_burn_folder (selection, &name, &size, &error); break; case NCB_SELECTION_SOURCE_DEVICE: res = verify_device (selection, &name, &size, &error); is_copy = TRUE; break; case NCB_SELECTION_SOURCE_CUE: res = verify_cue (selection, &name, &size, &error); break; case NCB_SELECTION_SOURCE_ISO: res = verify_iso (selection, &name, &size, &error); break; default: g_assert_not_reached (); break; } if (! res) { goto fail; } ncb_selection_set_size (selection, size); if (name == NULL) { name = create_default_label (); } ncb_selection_set_label (selection, name); g_free (name); selection->priv->update_source_idle_id = 0; return FALSE; fail: g_free (name); selection->priv->update_source_idle_id = 0; if (error != NULL) { ncb_hig_show_error_dialog (_("Unable to create CD/DVD"), error->message, NULL); g_error_free (error); } gtk_main_quit (); return FALSE; }
int verify_options (struct silo_options *o) { int rc = 0; int dev = 0; int crc = 0; if (!o->ipldevice || !o->image || !o->bootsect) { if (!o->ipldevice) fprintf(stderr,"ipldevice\n"); if (!o->image) fprintf(stderr,"image\n"); if (!o->bootsect) fprintf(stderr,"bootsect\n"); usage (); exit (1); } PRINT_LEVEL (1, "Testlevel is set to %d\n",o->testlevel); PRINT_LEVEL (1, "IPL device is: '%s'", o->ipldevice); ITRY (dev = verify_device (o->ipldevice)); PRINT_LEVEL (2, "...ok...(%d/%d)", (unsigned short) MAJOR (dev), (unsigned short) MINOR (dev)); PRINT_LEVEL (1, "\n"); PRINT_LEVEL (0, "bootsector is: '%s'", o->bootsect); ITRY (verify_file (o->bootsect, dev)); PRINT_LEVEL (1, "...ok..."); PRINT_LEVEL (0, "\n"); if ( o -> testlevel > 0 && ! strncmp( o->bootmap, SILO_BOOTMAP,strlen(SILO_BOOTMAP) )) { NTRY( o -> bootmap = tempnam(NULL,"boot.")); } PRINT_LEVEL (0, "bootmap is set to: '%s'", o->bootmap); if ( access ( o->bootmap, O_RDWR ) == -1 ) { if ( errno == ENOENT ) { ITRY (creat ( o-> bootmap, O_RDWR )); } else { PRINT_LEVEL(1,"Cannot acces bootmap file '%s': %s\n",o->bootmap, strerror(errno)); } } ITRY (verify_file (o->bootmap, dev)); PRINT_LEVEL (1, "...ok..."); PRINT_LEVEL (0, "\n"); PRINT_LEVEL (0, "Kernel image is: '%s'", o->image); ITRY (verify_file (o->image, dev)); PRINT_LEVEL (1, "...ok..."); PRINT_LEVEL (0, "\n"); PRINT_LEVEL (0, "original parameterfile is: '%s'", o->parmfile); ITRY (verify_file (o->parmfile, dev)); PRINT_LEVEL (1, "...ok..."); o->parmfile = gen_tmpparm(o->parmfile); PRINT_LEVEL (0, "final parameterfile is: '%s'", o->parmfile); ITRY (verify_file (o->parmfile, dev)); PRINT_LEVEL (1, "...ok..."); PRINT_LEVEL (0, "\n"); if (o->ramdisk) { PRINT_LEVEL (0, "initialramdisk is: '%s'", o->ramdisk); ITRY (verify_file (o->ramdisk, dev)); PRINT_LEVEL (1, "...ok..."); PRINT_LEVEL (0, "\n"); } return crc; }