Fixed registration. Fixed possible SIGSEGV in create_print_name

This commit is contained in:
Vysheng 2014-02-07 19:40:39 +04:00
parent c5333c0375
commit f647b8f0f3
3 changed files with 6 additions and 3 deletions

4
loop.c
View File

@ -545,13 +545,13 @@ int loop (void) {
exit (EXIT_SUCCESS);
}
char *first_name;
printf ("Name: ");
printf ("First name: ");
if (net_getline (&first_name, &size) == -1) {
perror ("getline()");
exit (EXIT_FAILURE);
}
char *last_name;
printf ("Name: ");
printf ("Last name: ");
if (net_getline (&last_name, &size) == -1) {
perror ("getline()");
exit (EXIT_FAILURE);

View File

@ -527,6 +527,9 @@ int do_auth_check_phone (const char *user) {
check_phone_result = -1;
send_query (DC_working, packet_ptr - packet_buffer, packet_buffer, &check_phone_methods, 0);
net_loop (0, cr_f);
check_phone_result = -1;
send_query (DC_working, packet_ptr - packet_buffer, packet_buffer, &check_phone_methods, 0);
net_loop (0, cr_f);
return check_phone_result;
}
/* }}} */

View File

@ -168,7 +168,7 @@ char *create_print_name (peer_id_t id, const char *a1, const char *a2, const cha
int cc = 0;
while (1) {
peer_t *P = peer_lookup_name (s);
if (!P || !cmp_peer_id (Peers[i]->id, id)) {
if (!P || !cmp_peer_id (P->id, id)) {
break;
}
cc ++;