1
0
forked from blue/pica
pica/main.cpp
2023-11-23 16:57:32 -03:00

28 lines
536 B
C++

#include <fcgiapp.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
#include "server/server.h"
int main() {
const char* socketPath = "/run/pica/pica.sock";
int sockfd = FCGX_OpenSocket(socketPath, 1024);
if (sockfd < 0) {
std::cerr << "Error opening socket" << std::endl;
return 1;
}
if (chmod(socketPath, 0777) != 0) {
std::cerr << "Couldn't set socket permissions" << std::endl;
return 2;
}
FCGX_Init();
Server server;
server.run(sockfd);
}