--- lbbs/src/file_loader.c 2025/10/18 12:06:10 1.17 +++ lbbs/src/file_loader.c 2025/11/04 14:58:56 1.20 @@ -1,18 +1,10 @@ -/*************************************************************************** - file_loader.c - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * file_loader + * - shared memory based file loader + * + * Copyright (C) 2004-2025 Leaflet + */ #include "file_loader.h" #include "log.h" @@ -60,7 +52,7 @@ static void trie_file_dict_cleanup_cb(co { int shmid = (int)value; - if (shmctl(shmid, IPC_RMID, NULL) == -1) + if (shmid != 0 && shmctl(shmid, IPC_RMID, NULL) == -1) { log_error("shmctl(shmid=%d, IPC_RMID) error (%d)\n", shmid, errno); } @@ -180,7 +172,7 @@ int load_file(const char *filename) { log_error("trie_dict_set(%s) error\n", filename); - if (shmctl(shmid, IPC_RMID, NULL) == -1) + if (shmid != 0 && shmctl(shmid, IPC_RMID, NULL) == -1) { log_error("shmctl(shmid=%d, IPC_RMID) error (%d)\n", shmid, errno); }