Commits

David du Colombier  committed 9ca2936

upas: fix warnings

smtp.c:232: warning: comparison with string literal results in unspecified behavior
smtp.c:244: warning: comparison with string literal results in unspecified behavior
marshal.c:1179: warning: variable ‘err’ set but not used

LGTM=rsc
R=rsc
https://codereview.appspot.com/93290043

  • Participants
  • Parent commits 6bfe553

Comments (2)

  1. Ilya Kostarev

    Changes in smtp.c broke functionality on darwin 10.9.3 Please undo or rethink

    Process: smtp [9359] Path: /usr/local/plan9/bin/upas/smtp Identifier: smtp Version: 0 Code Type: X86-64 (Native) Parent Process: rc [921] Responsible: smtp [9359] User ID: 501

    Date/Time: 2014-05-27 21:38:17.104 +0400 OS Version: Mac OS X 10.9.3 (13D65) Report Version: 11 Anonymous UUID: EFD9D91F-DBBB-1597-247A-29E582A3AA20

    Sleep/Wake UUID: 02DB53A7-F1B0-4B9A-8F38-5917C73FCD91

    Crashed Thread: 0 Dispatch queue: com.apple.main-thread

    Exception Type: EXC_CRASH (SIGSEGV) Exception Codes: 0x0000000000000000, 0x0000000000000000

    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff81322292 __kill + 10 1 smtp 0x0000000102a8606f child + 223 (daemonize.c:38) 2 libsystem_platform.dylib 0x00007fff86f725aa _sigtramp + 26 3 ??? 000000000000000000 0 + 0 4 smtp 0x0000000102a87a90 p9main + 48 (thread.c:723) 5 smtp 0x0000000102a902a9 main + 9 (main.c:11) 6 libdyld.dylib 0x00007fff872685fd start + 1

    Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x00007fff5d186200 rcx: 0x00007fff5d185d38 rdx: 0x0000000000000000 rdi: 0x000000000000248f rsi: 0x000000000000000b rbp: 0x00007fff5d185d60 rsp: 0x00007fff5d185d38 r8: 0x0000000000000000 r9: 0x00000000ffffffec r10: 0x0000000000000000 r11: 0x0000000000000206 r12: 0x0000000102a9c570 r13: 0x0000000000000000 r14: 0x00007fff5d1862e0 r15: 0x00007fff5d1862c0 rip: 0x00007fff81322292 rfl: 0x0000000000000206 cr2: 0x0000000102a8602d

    Logical CPU: 0 Error Code: 0x02000025 Trap Number: 133

    Binary Images: 0x102a78000 - 0x102a9ef0f +smtp (0) <CED70185-5BED-3D46-B894-CEC3556E0F36> /usr/local/plan9/bin/upas/smtp 0x7fff695a9000 - 0x7fff695dc817 dyld (239.4) <042C4CED-6FB2-3B1C-948B-CAF2EE3B9F7A> /usr/lib/dyld 0x7fff80855000 - 0x7fff8085cff3 libcopyfile.dylib (103) <5A881779-D0D6-3029-B371-E3021C2DDA5E> /usr/lib/system/libcopyfile.dylib 0x7fff81305000 - 0x7fff8130aff7 libunwind.dylib (35.3) <78DCC358-2FC1-302E-B395-0155B47CB547> /usr/lib/system/libunwind.dylib 0x7fff8130b000 - 0x7fff8130cff7 libsystem_sandbox.dylib (278.11) <B46E4040-A8C6-3EBC-91F8-F1CB01106614> /usr/lib/system/libsystem_sandbox.dylib 0x7fff8130d000 - 0x7fff81329ff7 libsystem_kernel.dylib (2422.100.13) <498AEBD7-4194-3CF2-AA16-D5D03FFBD8C0> /usr/lib/system/libsystem_kernel.dylib 0x7fff825a3000 - 0x7fff825caffb libsystem_info.dylib (449.1.3) <7D41A156-D285-3849-A2C3-C04ADE797D98> /usr/lib/system/libsystem_info.dylib 0x7fff82e46000 - 0x7fff82e6dff7 libsystem_network.dylib (241.3) <8B1E1F1D-A5CC-3BAE-8B1E-ABC84337A364> /usr/lib/system/libsystem_network.dylib 0x7fff83a18000 - 0x7fff83a18ff7 libkeymgr.dylib (28) <3AA8D85D-CF00-3BD3-A5A0-E28E1A32A6D8> /usr/lib/system/libkeymgr.dylib 0x7fff84947000 - 0x7fff84976fd2 libsystem_m.dylib (3047.16) <B7F0E2E4-2777-33FC-A787-D6430B630D54> /usr/lib/system/libsystem_m.dylib 0x7fff85989000 - 0x7fff8598dff7 libsystem_stats.dylib (93.90.3) <4E51D5B0-92A0-3D0D-B90E-495A1ED3E391> /usr/lib/system/libsystem_stats.dylib 0x7fff86f6f000 - 0x7fff86f75ff7 libsystem_platform.dylib (24.90.1) <3C3D3DA8-32B9-3243-98EC-D89B9A1670B3> /usr/lib/system/libsystem_platform.dylib 0x7fff86fd6000 - 0x7fff86fd8ff3 libsystem_configuration.dylib (596.15) <4998CB6A-9D54-390A-9F57-5D1AC53C135C> /usr/lib/system/libsystem_configuration.dylib 0x7fff86fd9000 - 0x7fff86fe0ff8 liblaunch.dylib (842.90.1) <38D1AB2C-A476-385F-8EA8-7AB604CA1F89> /usr/lib/system/liblaunch.dylib 0x7fff87265000 - 0x7fff87268ff7 libdyld.dylib (239.4) <7C9EC3B7-DDE3-33FF-953F-4067C743951D> /usr/lib/system/libdyld.dylib 0x7fff87269000 - 0x7fff8727aff7 libsystem_asl.dylib (217.1.4) <655FB343-52CF-3E2F-B14D-BEBF5AAEF94D> /usr/lib/system/libsystem_asl.dylib 0x7fff8727b000 - 0x7fff87297fff libresolv.9.dylib (54) <11C2C826-F1C6-39C6-B4E8-6E0C41D4FA95> /usr/lib/libresolv.9.dylib 0x7fff8739d000 - 0x7fff8739eff7 libsystem_blocks.dylib (63) <FB856CD1-2AEA-3907-8E9B-1E54B6827F82> /usr/lib/system/libsystem_blocks.dylib 0x7fff87ad0000 - 0x7fff87ad1ff7 libDiagnosticMessagesClient.dylib (100) <4CDB0F7B-C0AF-3424-BC39-495696F0DB1E> /usr/lib/libDiagnosticMessagesClient.dylib 0x7fff8803a000 - 0x7fff8807cff7 libauto.dylib (185.5) <F45C36E8-B606-3886-B5B1-B6745E757CA8> /usr/lib/libauto.dylib 0x7fff88088000 - 0x7fff880a2fff libdispatch.dylib (339.92.1) <C4E4A18D-3C3B-3C9C-8709-A4270D998DE7> /usr/lib/system/libdispatch.dylib 0x7fff8854b000 - 0x7fff8856ffff libxpc.dylib (300.90.2) <AB40CD57-F454-3FD4-B415-63B3C0D5C624> /usr/lib/system/libxpc.dylib 0x7fff88570000 - 0x7fff88572ff7 libquarantine.dylib (71) <7A1A2BCB-C03D-3A25-BFA4-3E569B2D2C38> /usr/lib/system/libquarantine.dylib 0x7fff88815000 - 0x7fff8881ffff libcommonCrypto.dylib (60049) <8C4F0CA0-389C-3EDC-B155-E62DD2187E1D> /usr/lib/system/libcommonCrypto.dylib 0x7fff8887e000 - 0x7fff888a7ff7 libc++abi.dylib (49.1) <21A807D3-6732-3455-B77F-743E9F916DF0> /usr/lib/libc++abi.dylib 0x7fff893c2000 - 0x7fff893c6ff7 libcache.dylib (62) <BDC1E65B-72A1-3DA3-A57C-B23159CAAD0B> /usr/lib/system/libcache.dylib 0x7fff898b6000 - 0x7fff898b7ffb libremovefile.dylib (33) <3543F917-928E-3DB2-A2F4-7AB73B4970EF> /usr/lib/system/libremovefile.dylib 0x7fff898e7000 - 0x7fff89a94f27 libobjc.A.dylib (551.1) <AD7FD984-271E-30F4-A361-6B20319EC73B> /usr/lib/libobjc.A.dylib 0x7fff89d1f000 - 0x7fff89d27fff libsystem_dnssd.dylib (522.90.2) <A0B7CF19-D9F2-33D4-8107-A62184C9066E> /usr/lib/system/libsystem_dnssd.dylib 0x7fff8a554000 - 0x7fff8a5a2fff libcorecrypto.dylib (161.1) <F3973C28-14B6-3006-BB2B-00DD7F09ABC7> /usr/lib/system/libcorecrypto.dylib 0x7fff8b558000 - 0x7fff8b5aafff libc++.1.dylib (120) <4F68DFC5-2077-39A8-A449-CAC5FDEE7BDE> /usr/lib/libc++.1.dylib 0x7fff8cfd1000 - 0x7fff8cfdaff3 libsystem_notify.dylib (121) <52571EC3-6894-37E4-946E-064B021ED44E> /usr/lib/system/libsystem_notify.dylib 0x7fff8d3a2000 - 0x7fff8d3a7fff libmacho.dylib (845) <1D2910DF-C036-3A82-A3FD-44FF73B5FF9B> /usr/lib/system/libmacho.dylib 0x7fff8d3a8000 - 0x7fff8d3afff7 libsystem_pthread.dylib (53.1.4) <AB498556-B555-310E-9041-F67EC9E00E2C> /usr/lib/system/libsystem_pthread.dylib 0x7fff8d64e000 - 0x7fff8d64fff7 libSystem.B.dylib (1197.1.1) <E303F2F8-A8CF-3DF3-84B3-F2D0EE41CCF6> /usr/lib/libSystem.B.dylib 0x7fff8d7a4000 - 0x7fff8d82dff7 libsystem_c.dylib (997.90.3) <6FD3A400-4BB2-3B95-B90C-BE6E9D0D78FA> /usr/lib/system/libsystem_c.dylib 0x7fff8d82e000 - 0x7fff8d82ffff libunc.dylib (28) <62682455-1862-36FE-8A04-7A6B91256438> /usr/lib/system/libunc.dylib 0x7fff8d836000 - 0x7fff8d851ff7 libsystem_malloc.dylib (23.10.1) <A695B4E4-38E9-332E-A772-29D31E3F1385> /usr/lib/system/libsystem_malloc.dylib 0x7fff8e256000 - 0x7fff8e25dfff libcompiler_rt.dylib (35) <4CD916B2-1B17-362A-B403-EF24A1DAC141> /usr/lib/system/libcompiler_rt.dylib

    External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 310192 thread_create: 0 thread_set_state: 0

    VM Region Summary: ReadOnly portion of Libraries: Total=71.5M resident=21.3M(30%) swapped_out_or_unallocated=50.2M(70%) Writable regions: Total=17.5M written=44K(0%) resident=144K(1%) swapped_out=0K(0%) unallocated=17.3M(99%)

    REGION TYPE VIRTUAL =========== ======= Kernel Alloc Once 4K MALLOC 9396K MALLOC (admin) 16K STACK GUARD 56.0M Stack 8192K VM_ALLOCATE 8K DATA 672K LINKEDIT 66.3M __TEXT 5360K shared memory 4K =========== ======= TOTAL 145.4M

Files changed (2)

File src/cmd/upas/marshal/marshal.c

 		err = w->msg;
 	if(pid >= 0 && (w=procwait(pid)) && w->msg[0])
 		err = w->msg;
-	return nil;
+	return err;
 }
 
 int

File src/cmd/upas/smtp/smtp.c

 	for(i = 0; i < argc; i++){
 		if((trv = rcptto(argv[i])) != 0){
 			/* remember worst error */
-			if(rv != Giveup)
+			if(strcmp(rv, Giveup) != 0)
 				rv = trv;
 			errs[rcvrs] = strdup(s_to_c(reply));
 			removenewline(errs[rcvrs]);
 	}
 
 	/* if no ok rcvrs or worst error is retry, give up */
-	if(ok == 0 || rv == Retry)
+	if(ok == 0 || strcmp(rv, Retry) == 0)
 		goto error;
 
 	if(ping){