/** * Pre-load a module from the current working directory * * @param module Module name including extension * * @return 0 if success, otherwise errorcode */ int module_preload(const char *module) { struct pl path, name; if (!module) return EINVAL; pl_set_str(&path, "."); pl_set_str(&name, module); return load_module(NULL, &path, &name); }
static int run_one_test(struct test *test) { int r; struct augeas *aug = NULL; struct memstream ms; int result = 0; MEMZERO(&ms, 1); aug = aug_init("/dev/null", lensdir, AUG_NO_STDINC|AUG_NO_MODL_AUTOLOAD); fail(aug == NULL, "aug_init"); fail(aug_error(aug) != AUG_NOERROR, "aug_init: errcode was %d", aug_error(aug)); printf("%-30s ... ", test->name); r = load_module(aug, test); if (r < 0) goto error; r = init_memstream(&ms); fail(r < 0, "init_memstream"); r = aug_srun(aug, ms.stream, test->cmd); fail(r != test->result, "return value: expected %d, actual %d", test->result, r); fail(aug_error(aug) != test->errcode, "errcode: expected %s, actual %s", errtokens[test->errcode], errtokens[aug_error(aug)]); r = close_memstream(&ms); fail(r < 0, "close_memstream"); fail(ms.buf == NULL, "close_memstream left buf NULL"); if (test->out != NULL) { fail(STRNEQ(ms.buf, test->out), "output: expected '%s', actual '%s'", test->out, ms.buf); } else if (test->out_present) { fail(strlen(ms.buf) == 0, "output: expected some output"); } else { fail(strlen(ms.buf) > 0, "output: expected nothing, actual '%s'", ms.buf); } printf("PASS\n"); done: free(ms.buf); aug_close(aug); return result; error: result = -1; goto done; }
int do_init_module(void __user * umod, unsigned long len, const char __user * uargs) { struct module *mod; int ret = 0; // TODO: non-preemptive kernel does not need to lock module mutex mod = load_module(umod, len, uargs); if (mod == NULL) { // TODO: non-preemptive kernel does not need to unlock module mutex return -1; } // TODO: non-preemptive kernel does not need to unlock module mutex struct module test_module; kprintf("Module size: %d\n", sizeof(test_module)); kprintf("list: %d\n", (int)&(test_module.list) - (int)&(test_module)); kprintf("name: %d\n", (int)&(test_module.name) - (int)&(test_module)); kprintf("kernel_symbol: %d\n", (int)&(test_module.syms) - (int)&(test_module)); kprintf("num_syms: %d\n", (int)&(test_module.num_syms) - (int)&(test_module)); kprintf("init: %d\n", (int)&(test_module.init) - (int)&(test_module)); kprintf("module_init: %d\n", (int)&(test_module.module_init) - (int)&(test_module)); kprintf("module_core: %d\n", (int)&(test_module.module_core) - (int)&(test_module)); kprintf("symtab: %d\n", (int)&(test_module.symtab) - (int)&(test_module)); kprintf("percpu: %d\n", (int)&(test_module.percpu) - (int)&(test_module)); kprintf("exit: %d\n", (int)&(test_module.exit) - (int)&(test_module)); if (mod->init != NULL) { ret = (*mod->init) (); } if (ret < 0) { mod->state = MODULE_STATE_GOING; // TODO: non-preemptive kernel does not need to lock module mutex free_module(mod); // TODO: non-preemptive kernel does not need to unlock return ret; } if (ret > 0) { kprintf("%s: %s->init suspiciously returned %d\n" "%s: loading anyway...\n", __func__, mod->name, ret, __func__); } mod->state = MODULE_STATE_LIVE; // TODO: lock? module_free(mod, mod->module_init); mod->module_init = NULL; mod->init_size = 0; mod->init_text_size = 0; // TODO: unlock return 0; }
int main (int argc, char **argv) { int ch; char * module = NULL; int pid = -1; banner(); while((ch = getopt(argc,argv,"vhf:p:")) > 0) { switch(ch) { case 'v': die(1,VPRINT); break; case 'h': die(1,USAGE,argv[0]); break; case 'f': module = strdup(optarg); break; case 'p': pid = atoi(optarg); break; default: break; } } if(pid == -1 || !module) die(1,USAGE,argv[0]); printf("@ PID:\t\t%d.\n",pid); printf("@ Module:\t%s.\n",module); load_module(module); if(hooker->size <= 0) die(1,"* Error: symbol size must be > 0.\n"); printf("@ Hook: found at <%p>[0..%u] <%p>.\n",hooker->init_hook,hooker->size,hooker->init_hook+hooker->size); if(HookInject(hooker,pid) < 0) { perror("ptrace"); exit(1); } return 0; }
GModule * tracker_extract_module_manager_get_for_mimetype (const gchar *mimetype, TrackerExtractInitFunc *init_func, TrackerExtractShutdownFunc *shutdown_func, TrackerExtractMetadataFunc *extract_func) { ModuleInfo *module_info = NULL; GList *mimetype_rules; if (init_func) { *init_func = NULL; } if (shutdown_func) { *shutdown_func = NULL; } if (extract_func) { *extract_func = NULL; } if (!initialized && !tracker_extract_module_manager_init ()) { return NULL; } mimetype_rules = lookup_rules (mimetype); if (!mimetype_rules) { return NULL; } module_info = load_module (mimetype_rules->data, FALSE); if (!module_info) { return NULL; } if (extract_func) { *extract_func = module_info->extract_func; } if (init_func) { *init_func = module_info->init_func; } if (shutdown_func) { *shutdown_func = module_info->shutdown_func; } return module_info->module; }
int mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name) { lt_dlhandle handle; char *modname; modname = strdup (name); if (!modname) return 1; fix_module_name (modname); handle = load_module (mach, modname); free (modname); return handle == NULL; }
int main_thread(SceSize args, void *argp) { char *argv0; char prx_path[256]; char *path; SceUID modid; int ret; pspDebugScreenInit(); sceDisplayWaitVblankStart(); pspSdkInstallNoDeviceCheckPatch(); pspSdkInstallNoPlainModuleCheckPatch(); pspSdkInstallKernelLoadModulePatch(); argv0 = (char*) argp; path = strrchr(argv0, '/'); if(path != NULL) { memcpy(prx_path, argv0, path - argv0 + 1); prx_path[path - argv0 + 1] = 0; strcat(prx_path, "psplink.prx"); } else { /* Well try for a default */ strcpy(prx_path, "ms0:/psplink.prx"); } /* Start mymodule.prx and dump its information */ printf("PSPLink Bootstrap TyRaNiD (c) 2k5 Version %s\n", PSPLINK_VERSION); modid = load_module(prx_path, 0, 0); if(modid >= 0) { int status; printf("Starting psplink module\n"); ret = sceKernelStartModule(modid, args, argp, &status, NULL); printf("Done\n"); } else { printf("Error loading psplink module %08X\n", modid); } /* Let's bug out */ sceKernelExitDeleteThread(0); return 0; }
/** * Allocate a new service for the gateway to support * * * @param servname The service name * @param router Name of the router module this service uses * * @return The newly created service or NULL if an error occurred */ SERVICE * service_alloc(const char *servname, const char *router) { SERVICE *service; if ((service = (SERVICE *)calloc(1, sizeof(SERVICE))) == NULL) return NULL; if ((service->router = load_module(router, MODULE_ROUTER)) == NULL) { char* home = get_maxscale_home(); char* ldpath = getenv("LD_LIBRARY_PATH"); LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Unable to load %s module \"%s\".\n\t\t\t" " Ensure that lib%s.so exists in one of the " "following directories :\n\t\t\t " "- %s/modules\n\t\t\t - %s", MODULE_ROUTER, router, router, home, ldpath))); free(service); return NULL; } service->name = strdup(servname); service->routerModule = strdup(router); service->users_from_all = false; service->resources = NULL; if (service->name == NULL || service->routerModule == NULL) { if (service->name) free(service->name); free(service); return NULL; } service->stats.started = time(0); service->state = SERVICE_STATE_ALLOC; spinlock_init(&service->spin); spinlock_init(&service->users_table_spin); spinlock_acquire(&service_spin); service->next = allServices; allServices = service; spinlock_release(&service_spin); return service; }
/** * Connect the downstream filter chain for a filter. * * This will create the filter instance, loading the filter module, and * conenct the fitler into the downstream chain. * * @param filter The filter to add into the chain * @param session The client session * @param downstream The filter downstream of this filter * @return The downstream component for the next filter or NULL * if the filter could not be created */ DOWNSTREAM * filterApply(FILTER_DEF *filter, SESSION *session, DOWNSTREAM *downstream) { DOWNSTREAM *me; if (filter == NULL) return NULL; if (filter->obj == NULL) { /* Filter not yet loaded */ if ((filter->obj = load_module(filter->module, MODULE_FILTER)) == NULL) { return NULL; } } if (filter->filter == NULL) { if ((filter->filter = (filter->obj->createInstance)(filter->options, filter->parameters)) == NULL) { return NULL; } } if ((me = (DOWNSTREAM *)calloc(1, sizeof(DOWNSTREAM))) == NULL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Memory allocation for filter session failed " "due to %d,%s.", errno, strerror(errno)))); return NULL; } me->instance = filter->filter; me->routeQuery = (void *)(filter->obj->routeQuery); if ((me->session=filter->obj->newSession(me->instance, session)) == NULL) { free(me); return NULL; } filter->obj->setDownstream(me->instance, me->session, downstream); return me; }
int main(int argc, char* argv[]) { int sockfd = init_socket(); logf("Server listening on port %d\n", PORT); if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { perror("Error setting SIGCHILD handler."); return EXIT_FAILURE; } load_module(); while (1) { socklen_t client_len = sizeof(client); int client_fd = accept(sockfd, (struct sockaddr*) &client, &client_len); if (client_fd < 0) { perror("Error creating socket for incoming connection"); exit(EXIT_FAILURE); } logf("New connection from %s on port %d\n", inet_ntoa(client.sin_addr), htons(client.sin_port)); int pid = fork(); if (pid < 0) { perror("Unable to fork"); exit(EXIT_FAILURE); } if (pid == 0) { // client alarm(300); close(sockfd); dup2(client_fd, 0); dup2(client_fd, 1); setvbuf(stdout, NULL, _IONBF, 0); drop_privs(); interact(); close(client_fd); logf("%s:%d disconnected\n", inet_ntoa(client.sin_addr), htons(client.sin_port)); exit(EXIT_SUCCESS); } else { // server logf("%s:%d forked new process with pid %d\n", inet_ntoa(client.sin_addr), htons(client.sin_port), pid); close(client_fd); } } }
void use_module(p_val *args, p_var **vars) { int i; char *path; for(i = 0; i < val_llen(args); i++) { if(strcmp(args[i].type, "str")) { fprintf(stderr, "use: all arguments must be strings\n"); exit(1); } path = vafmt("%s/%s.so", MODULE_DIR, basename((char *)args[i].val)); load_module(path, vars); free(path); } }
static void doLoadModule(configValue a) { char registry_only = 0; if (a.argNum == 3 && !strcasecmp("READ_REG", a.argument[2])) { registry_only++; } else if (a.argNum == 3) { info("%s should be READ_REG or nothing", a.argument[2]); } if (load_module(a.argument[0], a.argument[1], registry_only) == NULL) { error("cannot load dynamic module[%s]", a.argument[1]); } }
NativePatch* insert_native_patch(World* world, Value* name) { NativePatch* patch = find_existing_native_patch(world, name); if (patch != NULL) return patch; patch = add_native_patch(world); set_value(&patch->name, name); // Make sure this module is loaded by a global name. The native patch won't // work if the module has only been loaded by filename or relative name. load_module(world, NULL, name); return patch; }
static int directory_import(const char *Path, const char *Name, int *IsRef, void **Data) { static void *(*load_module)(const char *Path, const char *Name) = 0; if (load_module == 0) { module_t *SysModule = module_load(0, "Sys/Module"); int IsRef0; module_import(SysModule, "_load", &IsRef0, (void **)&load_module); }; void *Module = load_module(Path, Name); if (Module) { *IsRef = 0; *Data = Module; return 1; } else { return 0; }; };
/* Fetch a library vtable by a pointer into the library definitions array. */ static svn_error_t * get_library_vtable_direct(fs_library_vtable_t **vtable, const struct fs_type_defn *fst, apr_pool_t *pool) { fs_init_func_t initfunc = NULL; const svn_version_t *my_version = svn_fs_version(); const svn_version_t *fs_version; initfunc = fst->initfunc; if (! initfunc) SVN_ERR(load_module(&initfunc, fst->fsap_name, pool)); if (! initfunc) return svn_error_createf(SVN_ERR_FS_UNKNOWN_FS_TYPE, NULL, _("Failed to load module for FS type '%s'"), fst->fs_type); { /* Per our API compatibility rules, we cannot ensure that svn_fs_initialize is called by the application. If not, we cannot create the common pool and lock in a thread-safe fashion, nor can we clean up the common pool if libsvn_fs is dynamically unloaded. This function makes a best effort by creating the common pool as a child of the global pool; the window of failure due to thread collision is small. */ if (!common_pool) SVN_ERR(svn_fs_initialize(NULL)); /* Invoke the FS module's initfunc function with the common pool protected by a lock. */ SVN_MUTEX__WITH_LOCK(common_pool_lock, initfunc(my_version, vtable, common_pool)); } fs_version = (*vtable)->get_version(); if (!svn_ver_equal(my_version, fs_version)) return svn_error_createf(SVN_ERR_VERSION_MISMATCH, NULL, _("Mismatched FS module version for '%s':" " found %d.%d.%d%s," " expected %d.%d.%d%s"), fst->fs_type, my_version->major, my_version->minor, my_version->patch, my_version->tag, fs_version->major, fs_version->minor, fs_version->patch, fs_version->tag); return SVN_NO_ERROR; }
int main(int argc, char* argv[]) { GtkWidget *win; GtkCssProvider *cssprovider; /* Disable global menus */ g_unsetenv ("UBUNTU_MENUPROXY"); gtk_init(&argc, &argv); win = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect(win, "realize", G_CALLBACK(on_realize), NULL); cssprovider = gtk_css_provider_new (); gtk_css_provider_load_from_data(cssprovider, "GtkMenuBar {\n" " -GtkMenuBar-internal-padding: 0;\n" " -GtkMenuBar-shadow-type: none;\n" "}\n" "GtkWidget {\n" " -GtkWidget-focus-line-width: 0;\n" " -GtkWidget-focus-padding: 0;\n" "}\n" ".menuitem {\n" " padding: 0px 0px 0px 0px;\n" "}\n", -1, NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER (cssprovider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); GtkWidget* menubar = gtk_menu_bar_new(); gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), GTK_PACK_DIRECTION_RTL); int i; for(i = 0; indicators[i]; i++) { if (!load_module(indicators[i], menubar)) { g_error("Unable to load module"); } } GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); gtk_container_add(GTK_CONTAINER(win), hbox); gtk_box_pack_end(GTK_BOX(hbox), menubar, FALSE, FALSE, 0); g_signal_connect_after(menubar, "draw", G_CALLBACK(on_draw), NULL); g_signal_connect(win, "draw", G_CALLBACK(on_draw), NULL); gtk_widget_show_all(win); gdk_window_process_updates(gtk_widget_get_window(win), TRUE); gtk_widget_set_app_paintable(win, TRUE); gtk_main(); return 0; }
Value import(StringConstPtr _file) { std::string file; string_to_std_string(_file, file); std::string path; if (expand_load_path(file, path)) { Module* module = NULL; if (module_is_loaded(path, module)) { return module->module; } else { module = load_module(path); return module->module; } } throw_exception_with_description("File not found in any load path: %@", file.c_str()); return NULL; }
static int module_app_handler(const struct pl *val, void *arg) { struct modapp *modapp; modapp = mem_zalloc(sizeof(*modapp), modapp_destructor); if (!modapp) return ENOMEM; if (load_module(&modapp->mod, arg, val)) { mem_deref(modapp); return 0; } list_prepend(&modappl, &modapp->le, modapp); return 0; }
static gboolean initialize_first_module (TrackerMimetypeInfo *info) { ModuleInfo *module_info = NULL; /* Actually iterates through the list loaded + initialized module */ while (info->cur && !module_info) { module_info = load_module (info->cur->data, TRUE); if (!module_info) { info->cur = info->cur->next; } } info->cur_module_info = module_info; return (info->cur_module_info != NULL); }
int reload_config (char *erbuf, int erlen) { char module_config_name[500]; xml_node *config = NULL; LNOTICE("reloading config for [%s]", module_name); snprintf(module_config_name, 500, "%s/%s.xml", global_config_path, module_name); if(xml_parse_with_report(module_config_name, erbuf, erlen)) { unload_module(); load_module(config); return 1; } return 0; }
int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, "Usage: %s <module.ko>\n", argv[0]); return 1; } load_module(argv[1]); Suite *s = kmod_suite(); SRunner *sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); int number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }
static int sys_insmod(char *buf, char *buf_k, char *file) { int ret=0; // cprintf("\n\n\t**********Inserting Module: %s **********\t\n\n",file); // cprintf("Buf = 0x%016x Buf_k = 0x%016x file = %s \n", buf, buf_k, file); if(KERN_ISLOADED == 0){ ret = kern_symbol_hash(buf_k); if(ret < 0){ cprintf("Failed to load Kernel Symbols. Aborting \n"); return -1; } KERN_ISLOADED = 1; } ret = load_module(buf, file); return ret; }
CError CModuleManager::install_module( const string &module_file, CModuleInstallResult &result ) { bool module_was_loaded = false; GUID module_id = CGuidHelper::null_guid; memset( &result, 0, sizeof( CModuleInstallResult ) ); module_was_loaded = load_module( module_file, CInterfaceDefinition::MODULE_3RD_PARTY, module_id ); if( module_was_loaded ) { result.module_id = module_id; return store_module( module_id ); } if( CGuidHelper::guid_is_null( module_id ) ) { return CError::FILE_VALIDATION_ERROR; } const CInterfaceDefinition *existing_interface = get_interface_by_module_id( module_id ); if( !existing_interface ) { INTEGRA_TRACE_ERROR << "can't lookup existing interface"; return CError::FAILED; } switch( existing_interface->get_module_source() ) { case CInterfaceDefinition::MODULE_SHIPPED_WITH_INTEGRA: case CInterfaceDefinition::MODULE_3RD_PARTY: case CInterfaceDefinition::MODULE_IN_DEVELOPMENT: return CError::MODULE_ALREADY_INSTALLED; case CInterfaceDefinition::MODULE_EMBEDDED: result.module_id = module_id; result.was_previously_embedded = true; return change_module_source( ( CInterfaceDefinition & ) *existing_interface, CInterfaceDefinition::MODULE_3RD_PARTY ); default: INTEGRA_TRACE_ERROR << "existing interface has unexpected module source"; return CError::FAILED; } }
void CModuleManager::load_modules_from_directory( const string &module_directory, CInterfaceDefinition::module_source source ) { DIR *directory_stream; struct dirent *directory_entry; const char *name; struct stat entry_data; GUID module_guid; directory_stream = opendir( module_directory.c_str() ); if( !directory_stream ) { INTEGRA_TRACE_ERROR << "unable to open directory: " << module_directory; return; } while( true ) { directory_entry = readdir( directory_stream ); if( !directory_entry ) { break; } name = directory_entry->d_name; string full_path = module_directory + CFileIO::path_separator + name; if( stat( full_path.c_str(), &entry_data ) != 0 ) { INTEGRA_TRACE_ERROR << "couldn't read directory entry data: " << strerror( errno ); continue; } switch( entry_data.st_mode & _S_IFMT ) { case S_IFDIR: /* directory */ continue; default: load_module( full_path, source, module_guid ); break; } } }
static PyObject * load_package(char *name, char *pathname) { PyObject *m, *d; PyObject *file = NULL; PyObject *path = NULL; int err; char buf[MAXPATHLEN+1]; FILE *fp = NULL; m = PyImport_AddModule(name); if (m == NULL) return NULL; if (Py_VerboseFlag) PySys_WriteStderr("import %s # directory %s\n", name, pathname); d = PyModule_GetDict(m); file = PyString_FromString(pathname); if (file == NULL) goto error; path = Py_BuildValue("[O]", file); if (path == NULL) goto error; err = PyDict_SetItemString(d, "__file__", file); if (err == 0) err = PyDict_SetItemString(d, "__path__", path); if (err != 0) goto error; buf[0] = '\0'; strcpy(buf, pathname); strcat(buf, "/__init__.py"); fp = fopen(buf, "r"); m = load_module(name, buf, fp); if (fp != NULL) fclose(fp); goto cleanup; error: m = NULL; cleanup: Py_XDECREF(path); Py_XDECREF(file); return m; }
static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); int i; if (!ctx) return 0; if (argc < 3 || !streq(argv[1], "load")) { log_error("expect: %s load <module>", argv[0]); return EXIT_FAILURE; } for (i = 2; argv[i]; i++) { log_debug("execute '%s' '%s'", argv[1], argv[i]); load_module(udev, argv[i]); } return EXIT_SUCCESS; }
static void start_process(const char *name, addr_t base, addr_t end) { console.s("Loading process ").s(name).endl(); Process *process = new Process; ptr_t entry = load_module(process, base, end); Thread *thread = new Thread(process); thread->stack = process->allocator.allocate(User::Block::Stack, 10); Memory::map(thread->stack->base + 1, thread->stack->pages - 1, Memory::rw_data_flags | Memory::usermode_bit, &process->address_space); thread->registers.set_ip(entry); thread->registers.set_stack((ptr_t)(thread->stack->base + thread->stack->pages)); Scheduler::queue(thread); }
static int module_app_handler(const struct pl *val, void *arg) { struct mod *mod = NULL; const struct mod_export *me; debug("module: loading app %r\n", val); if (load_module(&mod, arg, val)) { return 0; } me = mod_export(mod); if (0 != str_casecmp(me->type, "application")) { warning("module_app %r should be type application (%s)\n", val, me->type); } return 0; }
static int match (unsigned int vendor_id, unsigned int specifier_id, unsigned int version) { int i; int retval; dbg ("vendor_id = %x, specifier_id = %x, version = %x", vendor_id, specifier_id, version); for (i = 0; ieee1394_module_map[i].module_name != NULL; ++i) { dbg ("looking at %s, match_flags = %x", ieee1394_module_map[i].module_name, ieee1394_module_map[i].match_flags); if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_VENDOR_ID) && (ieee1394_module_map[i].vendor_id != vendor_id)) { dbg ("vendor check failed %x != %x", ieee1394_module_map[i].vendor_id, vendor_id); continue; } if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_SPECIFIER_ID) && (ieee1394_module_map[i].specifier_id != specifier_id)) { dbg ("specifier_id check failed %x != %x", ieee1394_module_map[i].specifier_id, specifier_id); continue; } if ((ieee1394_module_map[i].match_flags & IEEE1394_MATCH_VERSION) && (ieee1394_module_map[i].version != version)) { dbg ("version check failed %x != %x", ieee1394_module_map[i].version, version); continue; } /* found one! */ dbg ("loading %s", ieee1394_module_map[i].module_name); retval = load_module (ieee1394_module_map[i].module_name); if (retval) return retval; } return -ENODEV; }
static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent) { _cleanup_fclose_ FILE *f = NULL; int r; assert(ctx); assert(path); r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); if (r < 0) { if (ignore_enoent && r == -ENOENT) return 0; log_error("Failed to open %s, ignoring: %s", path, strerror(-r)); return r; } log_debug("apply: %s", path); for (;;) { char line[LINE_MAX], *l; int k; if (!fgets(line, sizeof(line), f)) { if (feof(f)) break; log_error("Failed to read file '%s', ignoring: %m", path); return -errno; } l = strstrip(line); if (!*l) continue; if (strchr(COMMENTS "\n", *l)) continue; k = load_module(ctx, l); if (k < 0 && r == 0) r = k; } return r; }