/******************************************************************** * FUNCTION set_error * * Generate an error stack entry or if log_error is enabled, * then log the error report right now. * * Used to flag internal code errors * * DO NOT USE THIS FUNCTION DIRECTLY! * USE THE SET_ERROR MACRO INSTEAD! * * INPUTS: * filename == C filename that caused the error * linenum -- line number in the C file that caused the error * status == internal error code * sqlError = mySQL error code (deprecated) * * RETURNS * the 'status' parameter will be returned *********************************************************************/ status_t set_error (const char *filename, int linenum, status_t status, int sqlError) { if (log_get_debug_level() > LOG_DEBUG_NONE) { log_error("\nE0:\n %s:%d\n Error %d: %s\n", filename, linenum, status, get_error_string(status)); } else if (error_level < MAX_ERR_LEVEL) { error_stack[error_level].linenum = linenum; error_stack[error_level].sqlError = sqlError; error_stack[error_level].status = status; strncpy(error_stack[error_level].filename, filename, MAX_ERR_FILENAME-1); error_stack[error_level].filename[MAX_ERR_FILENAME-1] = 0; error_stack[error_level].msg = get_error_string(status); error_level++; } error_count++; return status; } /* set_error */
int closeSaHpiSession () { DEBUGMSGTL ((AGENT, "--- closeSaHpiSession: Entry. ")); if (session_avail == AGENT_TRUE) { err = saHpiUnsubscribe (session_id); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiUnsubscirbe error: %s.\n", get_error_string (err)); return AGENT_ERR_SESSION_CLOSE; } err = saHpiFinalize (); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiFinalize error: %s\n", get_error_string (err)); return AGENT_ERR_SESSION_CLOSE; } session_avail = AGENT_FALSE; } DEBUGMSGTL ((AGENT, "--- closeSaHpiSession: Exit. ")); return AGENT_ERR_NOERROR; }
void get_wavelengths(int index) { int error; int flag; int spec_length; double *wls = 0; spec_length = seabreeze_get_formatted_spectrum_length(index, &error); printf("spectrum length is (%d) [%s]\n", spec_length, get_error_string(error)); if(spec_length > 0) { wls = (double *)calloc((size_t)spec_length, sizeof(double)); printf("\nGetting wavelengths.\n"); flag = seabreeze_get_wavelengths(index, &error, wls, spec_length); printf("...Result is (%d) [%s]\n", flag, get_error_string(error)); FILE *f = fopen(filename, "w"); if (f != NULL){ fprintf(f, "sampleNum,deviceIndex,date,time,roll,pitch,yaw,lat,lon,"); for (unsigned pixel = 0; pixel < spec_length; pixel++) fprintf(f, "%.2lf,", wls[pixel]); fprintf(f, "\n"); fclose(f); } else{ printf("ERROR: can't write %s\n", "test"); exit(1); } free(wls); } }
void QMLManager::loadDivesWithValidCredentials() { QString url; if (getCloudURL(url)) { QString errorString(get_error_string()); appendTextToLog(errorString); setStartPageText(RED_FONT + tr("Cloud storage error: %1").arg(errorString) + END_FONT); setAccessingCloud(-1); alreadySaving = false; return; } QByteArray fileNamePrt = QFile::encodeName(url); git_repository *git; const char *branch; int error; if (check_git_sha(fileNamePrt.data(), &git, &branch) == 0) { qDebug() << "local cache was current, no need to modify dive list"; appendTextToLog("Cloud sync shows local cache was current"); setLoadFromCloud(true); setAccessingCloud(-1); alreadySaving = false; return; } appendTextToLog("Cloud sync brought newer data, reloading the dive list"); clear_dive_file_data(); if (git != dummy_git_repository) { appendTextToLog(QString("have repository and branch %1").arg(branch)); error = git_load_dives(git, branch); } else { appendTextToLog(QString("didn't receive valid git repo, try again")); error = parse_file(fileNamePrt.data()); } setAccessingCloud(-1); if (!error) { report_error("filename is now %s", fileNamePrt.data()); const char *error_string = get_error_string(); appendTextToLog(error_string); set_filename(fileNamePrt.data(), true); } else { report_error("failed to open file %s", fileNamePrt.data()); QString errorString(get_error_string()); appendTextToLog(errorString); setStartPageText(RED_FONT + tr("Cloud storage error: %1").arg(errorString) + END_FONT); alreadySaving = false; return; } prefs.unit_system = informational_prefs.unit_system; if (informational_prefs.unit_system == IMPERIAL) informational_prefs.units = IMPERIAL_units; prefs.units = informational_prefs.units; DiveListModel::instance()->clear(); process_dives(false, false); DiveListModel::instance()->addAllDives(); appendTextToLog(QStringLiteral("%1 dives loaded").arg(dive_table.nr)); if (dive_table.nr == 0) setStartPageText(tr("Cloud storage open successfully. No dives in dive list.")); setLoadFromCloud(true); alreadySaving = false; }
/******************************************************************** * FUNCTION read_txid_file * * Read the transaction ID file and return the current ID value found * * INPUTS: * txidfile == full filespec of the transaction ID file * curid == address of return ID * * OUTPUTS: * *curid == return current ID (if return NO_ERR * * RETURNS: * status *********************************************************************/ static status_t read_txid_file (const xmlChar *txidfile, cfg_transaction_id_t *curid) { assert( txidfile && "txidfile is NULL" ); assert( curid && "curid is NULL" ); *curid = 0; status_t res = NO_ERR; FILE *fil = fopen((const char *)txidfile, "r"); if (!fil) { res = errno_to_status(); log_error("\nError: Open txid file for read failed (%s)", get_error_string(res)); return res; } char buffer [128]; if (fgets(buffer, sizeof buffer, fil)) { /* expecting just 1 line containing the ASCII encoding of * the transaction ID */ log_debug4("\nRead transaction ID line '%s'", buffer); uint32 len = xml_strlen((const xmlChar *)buffer); if (len > 1) { /* strip ending newline */ buffer[len-1] = 0; ncx_num_t num; ncx_init_num(&num); res = ncx_convert_num((xmlChar *)buffer, NCX_NF_DEC, NCX_BT_UINT64, &num); if (res == NO_ERR) { agt_cfg_txid = num.ul; *curid = num.ul; log_debug3("\nGot transaction ID line '%llu'", (unsigned long long)num.ul); } else { log_error("\nError: txid is not valid (%s)", get_error_string(res)); } ncx_clean_num(NCX_BT_UINT64, &num); } else { res = ERR_NCX_INVALID_NUM; log_error("\nError: txid is not valid (%s)", get_error_string(res)); } } else { res = errno_to_status(); log_error("\nError: Read txid file failed (%s)", get_error_string(res)); } fclose(fil); return res; } /* read_txid_file */
int getSaHpiSession (SaHpiSessionIdT * out) { SaHpiVersionT version; DEBUGMSGTL ((AGENT, "--- getSaHpiSession: Entry. ")); if (session_avail == AGENT_FALSE) { err = saHpiInitialize (&version); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiInitialize error: %s\n", get_error_string (err)); return AGENT_ERR_INIT; } err = saHpiSessionOpen (SAHPI_DEFAULT_DOMAIN_ID, &session_id, NULL); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiSessionOpen error: %s\n", get_error_string (err)); return AGENT_ERR_SESSION_OPEN; } err = saHpiSubscribe (session_id, SAHPI_FALSE); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiSubscribe failed. error: %s\n", get_error_string (err)); return AGENT_ERR_SUBSCRIBE; } session_avail = AGENT_TRUE; //Subscribe to the Events } rediscover_count--; if (rediscover_count <= 0) { // Re-set the rediscover_count; DEBUGMSGTL ((AGENT, "Calling 'saHpiResourceDiscover()'.\n")); rediscover_count = REDISCOVER_COUNT_MAX; err = saHpiResourcesDiscover (session_id); if (SA_OK != err) { snmp_log (LOG_ERR, "saHpiResourcesDiscover error: %s\n", get_error_string (err)); return AGENT_ERR_DISCOVER; } } if (out) *out = session_id; DEBUGMSGTL ((AGENT, "--- getSaHpiSession: Exit\n")); return AGENT_ERR_NOERROR; }
/******************************************************************** * FUNCTION y_starter_processDone_send * * Send a y_starter_processDone notification * Called by your code when notification event occurs * ********************************************************************/ void y_starter_processDone_send ( const xmlChar *processStatus, const xmlChar *etc) { agt_not_msg_t *notif; val_value_t *parmval; status_t res = NO_ERR; if (LOGDEBUG) { log_debug("\nGenerating <processDone> notification"); } notif = agt_not_new_notification(processDone_obj); if (notif == NULL) { log_error("\nError: malloc failed, cannot send " "<processDone> notification"); return; } /* add processStatus to payload */ parmval = agt_make_leaf( processDone_obj, y_starter_N_processStatus, processStatus, &res); if (parmval == NULL) { log_error( "\nError: make leaf failed (%s), cannot send " "<processDone> notification", get_error_string(res)); } else { agt_not_add_to_payload(notif, parmval); } /* add etc to payload */ parmval = agt_make_leaf( processDone_obj, y_starter_N_etc, etc, &res); if (parmval == NULL) { log_error( "\nError: make leaf failed (%s), cannot send " "<processDone> notification", get_error_string(res)); } else { agt_not_add_to_payload(notif, parmval); } agt_not_queue_notification(notif); } /* y_starter_processDone_send */
void saftest_daemon_handle_incoming_clm_message(void *data, void *key) { clm_session_t *clm_session = data; fd_set *fd_mask = (fd_set *)key; SaAisErrorT err; if (NULL == data) { return; } if (!FD_ISSET(clm_session->selection_object, fd_mask)) { return; } saftest_log("Incoming request on clm selection fd %d. " "Calling saClmDispatch\n", clm_session->selection_object); saftest_assert(SA_DISPATCH_BLOCKING != clm_session->dispatch_flags, "It will have its own dispatch thread\n"); err = saClmDispatch(clm_session->clm_handle, clm_session->dispatch_flags); if (SA_AIS_OK != err) { saftest_log("Error %s performing saClmDispatch\n", get_error_string(err)); /* !!! We may only want to do this for "short-lived" drivers */ exit(1); } }
static void * _cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error) { CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; CoglDisplayEGL *egl_display = ctx->display->winsys; EGLint attribs[3]; EGLContext egl_context; attribs[0] = EGL_CONTEXT_CLIENT_VERSION; attribs[1] = 2; attribs[2] = EGL_NONE; egl_context = eglCreateContext (egl_renderer->edpy, egl_display->egl_config, egl_display->egl_context, attribs); if (egl_context == EGL_NO_CONTEXT) { _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, "%s", get_error_string ()); return NULL; } return (void *)egl_context; }
void MainWindow::on_actionCloudstorageopen_triggered() { if (!okToClose(tr("Please save or cancel the current dive edit before opening a new file."))) return; QString filename; if (getCloudURL(filename)) { getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); return; } qDebug() << filename; closeCurrentFile(); int error; QByteArray fileNamePtr = QFile::encodeName(filename); error = parse_file(fileNamePtr.data()); if (!error) { set_filename(fileNamePtr.data(), true); setTitle(MWTF_FILENAME); } getNotificationWidget()->hideNotification(); process_dives(false, false); refreshDisplay(); ui.actionAutoGroup->setChecked(autogroup); }
PyObject * pyhook_location(PyObject *self, PyObject *args) { WPS_Location *location; WPS_ReturnCode rc; PyObject *retval; int addressLookupType = WPS_NO_STREET_ADDRESS_LOOKUP; WPS_SimpleAuthentication auth = get_wps_auth(); if (!PyArg_ParseTuple(args, "|i", &addressLookupType)) return NULL; rc = WPS_location(&auth, addressLookupType, &location); if (rc != WPS_OK) { PyErr_SetString(PyhookError, get_error_string(rc)); retval = NULL; } else { retval = pyhook_BuildLocationValue(location); WPS_free_location(location); } return retval; }
static PyObject * pyhook_iplocation(PyObject *self, PyObject *args) { WPS_IPLocation *ip_location; WPS_ReturnCode rc; PyObject *retval; int addressLookupType = WPS_NO_STREET_ADDRESS_LOOKUP; WPS_SimpleAuthentication auth = get_wps_auth(); if (!PyArg_ParseTuple(args, "|i", &addressLookupType)) return NULL; rc = WPS_ip_location(&auth, addressLookupType, &ip_location); if (rc != WPS_OK) { PyErr_SetString(PyhookError, get_error_string(rc)); retval = NULL; } else { retval = Py_BuildValue("{s:s,s:f,s:f,s:O&}", "ip", ip_location->ip, "latitude", ip_location->latitude, "longitude", ip_location->longitude, "streetAddress", convertStreetAddress, ip_location->street_address); WPS_free_ip_location(ip_location); } return retval; }
void QMLManager::saveChangesLocal() { if (unsaved_changes()) { git_storage_update_progress(true, "saving dives locally"); // reset the timers if (!loadFromCloud()) { // this seems silly, but you need a common ancestor in the repository in // order to be able to merge che changes later appendTextToLog("Don't save dives without loading from the cloud, first."); return; } if (alreadySaving) { appendTextToLog("save operation already in progress, can't save locally"); return; } alreadySaving = true; bool glo = prefs.git_local_only; prefs.git_local_only = true; if (save_dives(existing_filename)) { appendTextToLog(get_error_string()); setAccessingCloud(-1); prefs.git_local_only = glo; alreadySaving = false; return; } prefs.git_local_only = glo; mark_divelist_changed(false); git_storage_update_progress(false, "done with local save"); alreadySaving = false; } else { appendTextToLog("local save requested with no unsaved changes"); } }
void add_error(list_t *errors, int code, size_t line_number, const char *line, int column, const char *file_name, ...) { error_t *error = malloc(sizeof(error_t)); error->code = code; error->line_number = line_number; error->file_name = malloc(strlen(file_name) + 1); strcpy(error->file_name, file_name); error->line = malloc(strlen(line) + 1); strcpy(error->line, line); error->column = column; const char *fmt = get_error_string(error); va_list args; va_start(args, file_name); int len = vsnprintf(NULL, 0, fmt, args); va_end(args); char *buf = malloc(len + 1); va_start(args, file_name); vsnprintf(buf, len + 1, fmt, args); va_end(args); error->message = buf; list_add(errors, error); scas_log(L_ERROR, "Added error '%s' at %s:%d:%d", buf, file_name, line_number, column); }
inline void assert(int cond, cl_int err, const char * desc) { if (!cond) { fprintf(stderr, "ERROR: %s %s\n", get_error_string(err), desc); exit((int) err); } }
static gboolean app_check_events (App * app) { GError *error = NULL; gboolean stop = FALSE; do { g_mutex_lock (&app->mutex); while (app->event == APP_RUNNING) g_cond_wait (&app->event_cond, &app->mutex); switch (app->event) { case APP_GOT_ERROR: error = app->error; app->error = NULL; /* fall-through */ case APP_GOT_EOS: stop = TRUE; break; default: break; } g_mutex_unlock (&app->mutex); } while (!stop); if (!error) return TRUE; g_message ("%s error: %s", get_error_string (error->code), error->message); g_error_free (error); return FALSE; }
void clfft_check(clfftStatus status, const char *file, int line) { if (CL_SUCCESS != status) { auto msg = get_error_string(status); util::die(file, line, "CLFFT error %d: %s\n", status, msg); } }
static void * _cg_winsys_device_create_gles2_context(cg_device_t *dev, cg_error_t **error) { cg_renderer_egl_t *egl_renderer = dev->display->renderer->winsys; cg_display_egl_t *egl_display = dev->display->winsys; EGLint attribs[3]; EGLContext egl_context; attribs[0] = EGL_CONTEXT_CLIENT_VERSION; attribs[1] = 2; attribs[2] = EGL_NONE; egl_context = eglCreateContext(egl_renderer->edpy, egl_display->egl_config, egl_display->egl_context, attribs); if (egl_context == EGL_NO_CONTEXT) { _cg_set_error(error, CG_WINSYS_ERROR, CG_WINSYS_ERROR_CREATE_GLES2_CONTEXT, "%s", get_error_string()); return NULL; } return (void *)egl_context; }
void check_error(char* msg) { if(get_error_status() < 0) { printf("%s\n", msg); printf("%s\n", get_error_string()); exit(1); } }
int main(void) { struct chessboard *c = get_new_board(); int tmp, sx, sy, dx, dy; while (1) { print_chessboard(c); /* Calcluate white's suggested move */ tmp = calculate_move(c, 0, MOVE_DEPTH); sx = tmp & 0xff; sy = (tmp & 0xff00) >> 8; dx = (tmp & 0xff0000) >> 16; dy = (tmp & 0xff000000) >> 24; printf("Computer suggests (%d,%d) -> (%d,%d)\n", sx, sy, dx, dy); no_clear: printf("Enter move: "); tmp = scanf("%d %d %d %d", &sx, &sy, &dx, &dy); if (tmp != 4) goto no_clear; if (sx == -1) return 0; tmp = execute_move(c, sx, sy, dx, dy); if (tmp) { printf("Error: %s\n", get_error_string(tmp)); goto no_clear; } else { printf("Move succeeded!\n"); } /* Calcluate black's move */ tmp = calculate_move(c, 1, MOVE_DEPTH); sx = tmp & 0xff; sy = (tmp & 0xff00) >> 8; dx = (tmp & 0xff0000) >> 16; dy = (tmp & 0xff000000) >> 24; printf("Black moves (%d,%d) -> (%d,%d)\n", sx, sy, dx, dy); tmp = execute_move(c, sx, sy, dx, dy); if (tmp) fatal("Computer tried to make an illegal move: %s\n", get_error_string(tmp)); } return 0; }
/******************************************************************** * FUNCTION save_aliases * * Save the aliases to the specified filespec * * INPUT: * fspec == output filespec to use (NULL == default) * * RETURNS: * status *********************************************************************/ status_t save_aliases (const xmlChar *fspec) { if (fspec == NULL) { fspec = get_aliases_file(); } status_t res = NO_ERR; xmlChar *fullspec = ncx_get_source(fspec, &res); if (res != NO_ERR) { log_error("\nError: Expand source '%s' failed (%s)\n", fspec, get_error_string(res)); return res; } res = check_for_saving_def_yangcli_file (ALIASES_FILE, fullspec); if (res != NO_ERR) { m__free(fullspec); return res; } FILE *fp = fopen((const char *)fullspec, "w"); if (fp) { /* this will truncate the file if there are no aliases */ alias_cb_t *alias; for (alias = get_first_alias(); alias != NULL; alias = get_next_alias(alias)) { write_alias(fp, alias); } /* Save mtime of this aliases file */ res = update_def_yangcli_file_mtime (ALIASES_FILE, fullspec); fclose(fp); } else { res = errno_to_status(); log_error("\nError: Open aliases file '%s' failed (%s)\n", fullspec, get_error_string(res)); } m__free(fullspec); return res; } /* save_aliases */
/******************************************************************** * * * FUNCTION main * * * *********************************************************************/ int main (int argc, char *argv[]) { status_t res; boolean showver = FALSE; boolean done = FALSE; help_mode_t showhelpmode; #ifdef MEMORY_DEBUG mtrace(); #endif /* this loop is used to implement the restart command the sw image is not * reloaded; instead everything is cleaned up and re-initialized from * scratch. If the shutdown operation (or Ctl-C exit) is used instead of * restart, then the loop will only be executed once */ while (!done) { res = cmn_init( argc, argv, &showver, &showhelpmode ); if (res != NO_ERR) { log_error( "\nnetconfd: init returned (%s)", get_error_string(res) ); agt_request_shutdown(NCX_SHUT_EXIT); } else { if (showver) { show_version(); } else if (showhelpmode != HELP_MODE_NONE) { help_program_module( NETCONFD_MOD, NETCONFD_CLI, showhelpmode ); agt_request_shutdown(NCX_SHUT_EXIT); } else { res = netconfd_run(); if (res != NO_ERR) { agt_request_shutdown(NCX_SHUT_EXIT); } } } netconfd_cleanup(); print_error_count(); if ( NCX_SHUT_EXIT == agt_shutdown_mode_requested() ) { done = TRUE; } } print_errors(); print_error_count(); if ( !log_is_open() ) { printf("\n"); } #ifdef MEMORY_DEBUG muntrace(); #endif return 0; } /* main */
// ------------------------------------------------------------------------- // Define Exception class impl // ------------------------------------------------------------------------- Exception::Exception(error_code code, const string &msg, const string &func, const string &file, int line) : code_(code), msg_(msg), func_(func), file_(file), line_(line) { std::ostringstream ss; ss << get_error_string(code_) << " error in " << func_ << std::endl << file_ << ":" << line_ << std::endl << msg_ << std::endl; full_msg_ = ss.str(); }
void SLang_doerror (char *error) { char *str = NULL; char *err; char *malloced_err_buf; char err_buf [1024]; malloced_err_buf = NULL; if (((SLang_Error == SL_USER_ERROR) || (SLang_Error == SL_USAGE_ERROR)) && (error != NULL) && (*error != 0)) err = error; else { char *sle = "S-Lang Error: "; unsigned int len = 0; char *fmt = "%s%s%s"; str = get_error_string (); if ((error == NULL) || (*error == 0)) error = ""; else if (SLang_Error == SL_UNKNOWN_ERROR) /* Do not display an unknown error message if error is non-NULL */ str = ""; else { fmt = "%s%s: %s"; len = 2; /* ": " */ } len += strlen (sle) + strlen (str) + strlen(error) + 1 /* trailing 0 */; err = err_buf; if (len > sizeof (err_buf)) { if (NULL == (malloced_err_buf = SLmalloc (len))) err = NULL; else err = malloced_err_buf; } if (err != NULL) sprintf (err, fmt, sle, str, error); else err = "Out of memory"; } if (SLang_Error_Hook == NULL) { fputs (err, stderr); fputs("\r\n", stderr); fflush (stderr); } else (*SLang_Error_Hook)(err); SLfree (malloced_err_buf); }
/******************************************************************** * FUNCTION write_txid_file * * Write the transaction ID file with the supplied value * * INPUTS: * txidfile == full filespec of the transaction ID file * curid == pointer to new txid to write * * RETURNS: * status *********************************************************************/ static status_t write_txid_file (const xmlChar *txidfile, cfg_transaction_id_t *curid) { assert( txidfile && "txidfile is NULL" ); assert( curid && "curid is NULL" ); status_t res = NO_ERR; FILE *fil = fopen((const char *)txidfile, "w"); if (!fil) { res = errno_to_status(); log_error("\nError: Opening txid file (%s) for write failed (%s)", (const char *)txidfile, get_error_string(res)); return res; } uint32 len = 0; char buffer [128]; ncx_num_t num; ncx_init_num(&num); num.ul = *curid; res = ncx_sprintf_num((xmlChar *)buffer, &num, NCX_BT_UINT64, &len); if (res == NO_ERR) { buffer[len] = '\n'; buffer[len+1] = 0; int ret = fputs(buffer, fil); if (ret <= 0) { res = errno_to_status(); log_error("\nError: write txid ID file failed (%s)", get_error_string(res)); } } else { log_error("\nError: sprintf txid ID failed (%s)", get_error_string(res)); } ncx_clean_num(NCX_BT_UINT64, &num); fclose(fil); return res; } /* write_txid_file */
void QMLManager::saveChangesLocal() { if (unsaved_changes()) { git_storage_update_progress(true, "saving dives locally"); // reset the timers if (credentialStatus() == NOCLOUD) { if (same_string(existing_filename, "")) { char *filename = NOCLOUD_LOCALSTORAGE; if (git_create_local_repo(filename)) appendTextToLog(get_error_string()); set_filename(filename, true); GeneralSettingsObjectWrapper s(this); s.setDefaultFilename(filename); s.setDefaultFileBehavior(LOCAL_DEFAULT_FILE); qDebug() << "setting default file to" << filename; } } else if (!loadFromCloud()) { // this seems silly, but you need a common ancestor in the repository in // order to be able to merge che changes later appendTextToLog("Don't save dives without loading from the cloud, first."); return; } if (alreadySaving) { appendTextToLog("save operation already in progress, can't save locally"); return; } alreadySaving = true; bool glo = prefs.git_local_only; prefs.git_local_only = true; if (save_dives(existing_filename)) { appendTextToLog(get_error_string()); set_filename(NULL, true); setAccessingCloud(-1); prefs.git_local_only = glo; alreadySaving = false; return; } prefs.git_local_only = glo; mark_divelist_changed(false); git_storage_update_progress(false, "done with local save"); alreadySaving = false; } else { appendTextToLog("local save requested with no unsaved changes"); } }
/******************************************************************** * FUNCTION agt_cap_set_modules * * Initialize the NETCONF agent capabilities modules list * MUST call after agt_cap_set_caps * * INPUTS: * profile == agent profile control block to use * * RETURNS: * status *********************************************************************/ status_t agt_cap_set_modules (agt_profile_t *profile) { if (!agt_caps || !my_agt_caps) { return SET_ERROR(ERR_INTERNAL_INIT_SEQ); } /* add the ietf-netconf module first */ status_t res = cap_add_netconf_modval(agt_caps); if (res != NO_ERR) { log_error("\nError: could not add ietf-netconf " "capability val (%s)\n", get_error_string(res)); return res; } ncx_module_t *mod = ncx_get_first_module(); /* add capability for each module loaded in ncxmod */ while (mod && res == NO_ERR) { /* keep internal modules out of the capabilities */ if (agt_advertise_module_needed(mod->name)) { res = cap_add_modval(agt_caps, mod); if (res == NO_ERR) { res = cap_add_mod(my_agt_caps, mod); } } mod = (ncx_module_t *)dlq_nextEntry(mod); } /* add capability for each deviation module, not already * listed in the module capabilities so far */ ncx_save_deviations_t *savedev; for (savedev = (ncx_save_deviations_t *) dlq_firstEntry(&profile->agt_savedevQ); savedev != NULL && res == NO_ERR; savedev = (ncx_save_deviations_t *) dlq_nextEntry(savedev)) { if (agt_advertise_module_needed(savedev->devmodule)) { /* make sure this is not a hard-wired internal module * or a duplicate already loaded as a regular module */ mod = ncx_find_module(savedev->devmodule, savedev->devrevision); if (mod == NULL) { /* not already announced in the capabilities */ res = cap_add_devmodval(agt_caps, savedev); } } } return res; } /* agt_cap_set_modules */
int set_hotswap_action_request (saHpiHotSwapTable_context * ctx) { SaHpiSessionIdT session_id; SaErrorT rc; SaHpiHsActionT action; if (ctx) { action = ctx->saHpiHotSwapActionRequest - 1; // Get the seesion_id rc = getSaHpiSession (&session_id); if (rc != AGENT_ERR_NOERROR) { DEBUGMSGTL ((AGENT, "Call to getSaHpiSession failed with rc: %d\n", rc)); return rc; } // Set the new value DEBUGMSGTL ((AGENT, "Calling saHpiHotSwapActionRequest with %d\n", ctx->resource_id)); rc = saHpiHotSwapActionRequest (session_id, ctx->resource_id, action); if (rc != SA_OK) { snmp_log (LOG_ERR, "Call to saHpiHotSwapActionRequest failed with return code: %s\n", get_error_string (rc)); DEBUGMSGTL ((AGENT, "Call to saHpiHotSwapActionRequest failed with return code: %s\n", get_error_string (rc))); return AGENT_ERR_OPERATION; } ctx->saHpiHotSwapActionRequest = action + 1; return AGENT_ERR_NOERROR; } return AGENT_ERR_NULL_DATA; }
void quan::report_errors() { while ( ! error_fifo.is_empty()){ error_info const & info = error_fifo.get(); user_message("in fn "); user_message(get_function_name(info.function_id)); user_message( " : "); user_message(get_error_string(info.error_id)); user_message("\n"); } }
void cleanUpAndClose(int exitCode) { int error = 0; for (int i = 0; i < connected_device_count; i++) { LOG_DEBUG(("[%02d] closing", i)); seabreeze_close_spectrometer(i, &error); if (error) { printf("[%02d] Error closing spectrometer: %s\n", i, get_error_string(error)); } } exit(exitCode); }