File tree 8 files changed +18
-0
lines changed
8 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ int main (int argc, char **argv)
63
63
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
64
64
if (errno == ECONNREFUSED )
65
65
fprintf (stderr , "Is the NCP server started?\n" );
66
+ else if (errno == EFAULT )
67
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
66
68
exit (1 );
67
69
}
68
70
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ int main (int argc, char **argv)
136
136
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
137
137
if (errno == ECONNREFUSED )
138
138
fprintf (stderr , "Is the NCP server started?\n" );
139
+ else if (errno == EFAULT )
140
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
139
141
exit (1 );
140
142
}
141
143
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ int main (int argc, char **argv)
22
22
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
23
23
if (errno == ECONNREFUSED )
24
24
fprintf (stderr , "Is the NCP server started?\n" );
25
+ else if (errno == EFAULT )
26
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
25
27
exit (1 );
26
28
}
27
29
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ int main (int argc, char **argv)
20
20
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
21
21
if (errno == ECONNREFUSED )
22
22
fprintf (stderr , "Is the NCP server started?\n" );
23
+ else if (errno == EFAULT )
24
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
23
25
exit (1 );
24
26
}
25
27
Original file line number Diff line number Diff line change @@ -231,6 +231,8 @@ int main (int argc, char **argv)
231
231
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
232
232
if (errno == ECONNREFUSED )
233
233
fprintf (stderr , "Is the NCP server started?\n" );
234
+ else if (errno == EFAULT )
235
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
234
236
exit (1 );
235
237
}
236
238
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ int main (int argc, char **argv)
71
71
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
72
72
if (errno == ECONNREFUSED )
73
73
fprintf (stderr , "Is the NCP server started?\n" );
74
+ else if (errno == EFAULT )
75
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
74
76
exit (1 );
75
77
}
76
78
Original file line number Diff line number Diff line change @@ -550,6 +550,8 @@ int main (int argc, char **argv)
550
550
fprintf (stderr , "NCP initialization error: %s.\n" , strerror (errno ));
551
551
if (errno == ECONNREFUSED )
552
552
fprintf (stderr , "Is the NCP server started?\n" );
553
+ else if (errno == EFAULT )
554
+ fprintf (stderr , "Is the NCP environment variable set?\n" );
553
555
exit (1 );
554
556
}
555
557
Original file line number Diff line number Diff line change 2
2
3
3
#include <fcntl.h>
4
4
#include <stdio.h>
5
+ #include <errno.h>
5
6
#include <stdlib.h>
6
7
#include <stdint.h>
7
8
#include <unistd.h>
@@ -52,6 +53,9 @@ int ncp_init (const char *path)
52
53
server .sun_family = AF_UNIX ;
53
54
if (path == NULL )
54
55
path = getenv ("NCP" );
56
+ errno = EFAULT ;
57
+ if (path == NULL )
58
+ return -1 ;
55
59
strncpy (server .sun_path , path , sizeof server .sun_path - 1 );
56
60
if (connect (fd , (struct sockaddr * ) & server , sizeof server ) == -1 )
57
61
return -1 ;
You can’t perform that action at this time.
0 commit comments