MCPcopy Create free account
hub / github.com/ccMSC/ckb / rmdevpath

Function rmdevpath

src/ckb-daemon/devnode.c:258–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258int rmdevpath(usbdevice* kb){
259 euid_guard_start;
260 int index = INDEX_OF(kb, keyboard);
261 if(kb->infifo != 0){
262#ifdef OS_LINUX
263 write(kb->infifo - 1, "\n", 1); // hack to prevent the FIFO thread from perma-blocking
264#endif
265 close(kb->infifo - 1);
266 kb->infifo = 0;
267 }
268 for(int i = 0; i < OUTFIFO_MAX; i++)
269 _rmnotifynode(kb, i);
270 char path[strlen(devpath) + 2];
271 snprintf(path, sizeof(path), "%s%d", devpath, index);
272 if(rm_recursive(path) != 0 && errno != ENOENT){
273 ckb_warn("Unable to delete %s: %s\n", path, strerror(errno));
274 euid_guard_stop;
275 return -1;
276 }
277 ckb_info("Removed device path %s\n", path);
278 euid_guard_stop;
279 return 0;
280}
281
282int mkfwnode(usbdevice* kb){
283 int index = INDEX_OF(kb, keyboard);

Callers 2

closeusbFunction · 0.85
quitFunction · 0.85

Calls 3

_rmnotifynodeFunction · 0.85
rm_recursiveFunction · 0.85
ckb_infoFunction · 0.50

Tested by

no test coverage detected