Init the log file and enable logging */
| 2139 | |
| 2140 | /* Init the log file and enable logging */ |
| 2141 | static int |
| 2142 | InitPacketAliasLog(struct libalias *la) |
| 2143 | { |
| 2144 | |
| 2145 | LIBALIAS_LOCK_ASSERT(la); |
| 2146 | if (~la->packetAliasMode & PKT_ALIAS_LOG) { |
| 2147 | #ifdef _KERNEL |
| 2148 | if ((la->logDesc = malloc(LIBALIAS_BUF_SIZE))) |
| 2149 | ; |
| 2150 | #else |
| 2151 | if ((la->logDesc = fopen("/var/log/alias.log", "w"))) |
| 2152 | fprintf(la->logDesc, "PacketAlias/InitPacketAliasLog: Packet alias logging enabled.\n"); |
| 2153 | #endif |
| 2154 | else |
| 2155 | return (ENOMEM); /* log initialization failed */ |
| 2156 | la->packetAliasMode |= PKT_ALIAS_LOG; |
| 2157 | } |
| 2158 | |
| 2159 | return (1); |
| 2160 | } |
| 2161 | |
| 2162 | /* Close the log-file and disable logging. */ |
| 2163 | static void |
no test coverage detected