Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
misc_new.c File Reference
#include <errno.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include <stdlib.h>
#include "../dlib/dlib.h"
#include "dpid_common.h"
#include "misc_new.h"
Include dependency graph for misc_new.c:

Go to the source code of this file.

Functions

Dstra_Misc_rdtag (int socket)
 
char * a_Misc_readtag (int sock)
 
char * a_Misc_mkdtemp (char *template)
 Alternative to mkdtemp().
 
char * a_Misc_mkfname (char *template)
 Return a new, nonexistent file name from a template.
 
char * a_Misc_mksecret (int nchar)
 Return a new, random hexadecimal string of 'nchar' characters.
 

Function Documentation

◆ a_Misc_mkdtemp()

char * a_Misc_mkdtemp ( char *  template)

Alternative to mkdtemp().

Reads a dpi tag from a socket without hanging on read.

  • Continues after a signal interrupt \Return
  • 1 on success
  • 0 if input is not available within timeout microseconds.
  • -1 on failure \important Caller is responsible for freeing the returned Dstr * Not as strong as mkdtemp, but enough for creating a directory.

Definition at line 131 of file misc_new.c.

References a_Misc_mkfname().

Referenced by mk_sockdir().

◆ a_Misc_mkfname()

char * a_Misc_mkfname ( char *  template)

Return a new, nonexistent file name from a template.

(adapted from dietlibc; alternative to mkdtemp())

Definition at line 147 of file misc_new.c.

References error(), and MSG_ERR.

Referenced by a_Misc_mkdtemp().

◆ a_Misc_mksecret()

char * a_Misc_mksecret ( int  nchar)

Return a new, random hexadecimal string of 'nchar' characters.

Definition at line 181 of file misc_new.c.

References dNew, and MSG.

Referenced by init_ids_srs_socket().

◆ a_Misc_rdtag()

Dstr * a_Misc_rdtag ( int  socket)

Reads a dpi tag from a socket

  • Continues after a signal interrupt \Return Dstr pointer to tag on success, NULL on failure \important Caller is responsible for freeing the returned Dstr *

Definition at line 28 of file misc_new.c.

References dStr_append_c(), dStr_free(), dStr_sized_new(), and TRUE.

◆ a_Misc_readtag()

char * a_Misc_readtag ( int  sock)

Read a dpi tag from sock

Returns
pointer to dynamically allocated request tag

Definition at line 58 of file misc_new.c.

References dMalloc(), dRealloc(), and ERRMSG.