mirror of
https://kernel.googlesource.com/pub/scm/network/tftp/tftp-hpa
synced 2025-04-28 19:09:53 +03:00
22 lines
276 B
C
22 lines
276 B
C
/*
|
|
* xstrdup.c
|
|
*
|
|
* Simple error-checking version of strdup()
|
|
*
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
char *xstrdup(const char *s)
|
|
{
|
|
char *p = strdup(s);
|
|
|
|
if ( !p ) {
|
|
fprintf(stderr, "Out of memory!\n");
|
|
exit(128);
|
|
}
|
|
|
|
return p;
|
|
}
|