/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

int FUN_004023c0(void)

{
  FILE *pFVar1;
  int iVar2;
  char *__ptr;
  int *piVar3;
  char *pcVar4;
  char *pcVar5;
  int iVar6;
  sockaddr local_120 [7];
  stat sStack_b0;
  
  iVar2 = stat(DAT_00433ce0,&sStack_b0)   //possible issue identified - semgrep
  if (iVar2 < 0) {
    __ptr = dirname(DAT_00433ce0);
    iVar2 = make_valid_path(__ptr,0x1f8);
    pFVar1 = _stderr;
    pcVar5 = DAT_00433ce0;
    if (iVar2 == 0) {
      piVar3 = __errno_location();
      pcVar4 = strerror(*piVar3);
      fprintf(pFVar1,"Could not make path to %s: %s\n",pcVar5,pcVar4);
      free(__ptr);
      return -1;
    }
    free(__ptr);
    iVar2 = socket(1,2,0);
    pFVar1 = _stderr;
    if (iVar2 < 0) {
      piVar3 = __errno_location();
      pcVar5 = strerror(*piVar3);
      fprintf(pFVar1,"socket: %s",pcVar5);
      return iVar2;
    }
    local_120[0].sa_family = 1;
    snprintf(local_120[0].sa_data,0x6c,"%s",DAT_00433ce0)   //possible issue identified - semgrep
    iVar6 = bind(iVar2,local_120,0x6e);
    pFVar1 = _stderr;
    if (-1 < iVar6) {
      chmod(local_120[0].sa_data,0x1ff)   //possible issue identified - semgrep
      listen(iVar2,0x20);
      return iVar2;
    }
    piVar3 = __errno_location();
    pcVar5 = strerror(*piVar3);
    fprintf(pFVar1,"bind: %s\n",pcVar5);
    close(iVar2);
  }
  else {
    fprintf(_stderr,"socket: %s for %s is already created!\n",DAT_00433ce0,"xmldb");
  }
  return -1;
}