equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * |
3 * |
4 * U.S. Government Rights - Commercial software. Government users are subject |
4 * U.S. Government Rights - Commercial software. Government users are subject |
5 * to the Sun Microsystems, Inc. standard license agreement and applicable |
5 * to the Sun Microsystems, Inc. standard license agreement and applicable |
6 * provisions of the FAR and its supplements. |
6 * provisions of the FAR and its supplements. |
7 * |
7 * |
81 switch (reqinfo->mode) { |
81 switch (reqinfo->mode) { |
82 |
82 |
83 case MODE_GET: |
83 case MODE_GET: |
84 motd[0] = '\0'; |
84 motd[0] = '\0'; |
85 fd = fopen("/etc/motd", "r"); |
85 fd = fopen("/etc/motd", "r"); |
86 fgets(motd, sizeof (motd), fd); |
86 |
87 fclose(fd); |
87 if (fd != NULL) { |
|
88 fgets(motd, sizeof (motd), fd); |
|
89 fclose(fd); |
|
90 } |
88 |
91 |
89 snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, |
92 snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, |
90 (u_char *) motd, strlen(motd)); |
93 (u_char *) motd, strlen(motd)); |
91 break; |
94 break; |
92 |
95 |